Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Livewire Markdown Editor Laravel Package

mckenziearts/livewire-markdown-editor

View on GitHub
Deep Wiki
Context7

Laravel Markdown Editor

GitHub-style Markdown editor for Laravel with Livewire and Alpine.js. This module provides a complete, standalone Markdown editing experience with full dark mode support.

Dependencies

  • Laravel 11+
  • Livewire 3.6+
  • Tailwind CSS 4.1
  • League CommonMark
  • GitHub Markdown Toolbar Element
  • GitHub Text Expander Element

Features

  • ๐ŸŽจ GitHub-style toolbar with all formatting options
  • ๐Ÿ“ Live markdown preview
  • ๐ŸŒ“ Full dark mode support
  • ๐Ÿ“Ž File upload with automatic Markdown insertion
  • โœจ GitHub Flavored Markdown (GFM) support
  • ๐Ÿ”– Spatie Shiki Highlight code blocks
  • ๐Ÿ“‹ Tables, task lists, and more
  • ๐Ÿ”„ Livewire integration with two-way binding
  • ๐ŸŽฏ Multiple editor instances support

Installation

Livewire Markdown editor can be installed via composer from your project root:

composer require mckenziearts/livewire-markdown-editor

Include the Markdown formatting buttons for text inputs Editor into your project:

npm install --save @github/markdown-toolbar-element @github/text-expander-element

2. Load assets

Add the module's JavaScript to your main resources/js/app.js:

import '../../vendor/mckenziearts/livewire-markdown-editor/resources/js/markdown-editor.js';

And the CSS file to your main resources/css/app.css:

@import "../../vendor/mckenziearts/livewire-markdown-editor/resources/css/markdown-editor.css";

Then build:

npm run build

3. Register the module

The service provider is auto-discovered via Laravel's package discovery.

Usage

Basic Usage

<livewire:markdown-editor wire:model="content" />

With Custom Configuration

<livewire:markdown-editor
    wire:model="comment"
    placeholder="Write your comment..."
    :rows="15"
    :show-toolbar="true"
    :show-upload="true"
/>

In Livewire Components

use Livewire\Component;

class CreatePost extends Component
{
    public string $content = '';

    public function save()
    {
        $this->validate([
            'content' => 'required|min:10',
        ]);

        // $this->content contains the markdown
    }

    public function render()
    {
        return view('livewire.create-post');
    }
}
<div>
    <livewire:markdown-editor wire:model="content" />

    <button wire:click="save">Save</button>
</div>

Component Properties

Property Type Default Description
content string '' The markdown content (use with wire:model)
placeholder string 'Leave a comment...' Textarea placeholder text
class string null Textarea custom classes
rows int 10 Number of textarea rows
showToolbar bool true Show/hide the markdown toolbar
showUpload bool true Show/hide the file upload button

Toolbar Features

  • Heading - Insert heading
  • Bold - Make text bold
  • Italic - Make text italic
  • Quote - Insert blockquote
  • Code - Insert code block
  • Link - Insert link
  • Unordered List - Insert bullet list
  • Ordered List - Insert numbered list
  • Task List - Insert checklist
  • File Upload - Upload and insert files/images

File Uploads

Files are automatically uploaded to the configured disk when selected. Images are inserted as ![filename](url) and other files as [filename](url).

Make sure your storage is properly configured:

php artisan storage:link

Security

To prevent arbitrary file upload vulnerabilities (stored XSS, phishing page hosting, malware distribution), only images are accepted by default. Uploaded files are stored under a randomly generated filename with the validated extension, and the original client-provided filename is sanitized before being inserted into the markdown output.

You can customize the allowed file types and max size via the upload config key:

// config/livewire-markdown-editor.php
'upload' => [
    'max_size' => 4096, // kilobytes
    'allowed_extensions' => ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif'],
    'images_only' => true,
],

If you need to allow non-image files, extend allowed_extensions and set images_only to false. When using a public cloud disk (S3, Spaces, R2, Scaleway), review the bucket policy to ensure non-whitelisted Content-Types cannot be served inline.

If you do not use file uploads at all, disable the feature entirely:

<livewire:markdown-editor
    wire:model="content"
    :show-upload="false"
/>

Markdown Support

The editor supports full GitHub Flavored Markdown including:

  • Headings
  • Bold, italic, strikethrough
  • Links and images
  • Code blocks with syntax highlighting
  • Task lists
  • Blockquotes
  • Horizontal rules

Dark Mode

Dark mode is fully supported and automatically follows your Tailwind CSS dark mode configuration.

Customization

Publishing Views

php artisan vendor:publish --tag=livewire-markdown-editor-views

Views will be published to resources/views/vendor/livewire-markdown-editor/.

Publishing Assets

php artisan vendor:publish --tag=livewire-markdown-editor-assets

License

Distributed under the MIT license. See LICENSE for details.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky