Fields
Markdown editor
MarkdownEditor edits Markdown with a toolbar, attachments and a preview rendered on the server.
use Xelqun\Forms\Components\MarkdownEditor;
MarkdownEditor::make('body')->minHeight('12rem')->maxHeight('32rem');
The server renders the preview.
Toolbar
MarkdownEditor::make('body')->toolbarButtons([['bold', 'italic'], ['link']]);
MarkdownEditor::make('body')->disableToolbarButtons(['attachFiles']);
Attachments
The same options as the rich editor: fileAttachments(), fileAttachmentsDisk(), fileAttachmentsDirectory(), fileAttachmentsMaxSize() and fileAttachmentsAcceptedFileTypes().
Showing it later
render() turns Markdown into HTML that's safe to print.
use Xelqun\Forms\Components\MarkdownEditor;
$html = MarkdownEditor::render($post->body);