Quick start
A minimal editor
Section titled “A minimal editor”<script lang="ts"> import { MarkdownEditor, headingsPlugin, listsPlugin, quotePlugin } from '@the-sumeet/sveltedown';
let markdown = $state('# Hello\n\nStart **writing**…'); const plugins = [headingsPlugin(), listsPlugin(), quotePlugin()];</script>
<MarkdownEditor bind:markdown {plugins} placeholder="Start writing…" />Without plugins, the editor supports paragraphs and inline formatting: bold, italic, underline,
inline code, strikethrough, highlight, and super and subscript. Every other construct comes from a
plugin. Markdown that uses a construct whose plugin isn’t enabled can’t be loaded: the editor
reports it through onerror.
Binding and events
Section titled “Binding and events”bind:markdown keeps your state and the editor in sync both ways. You can also listen to changes:
<MarkdownEditor markdown={initial} onchange={(markdown, initialMarkdownNormalize) => save(markdown)}/>initialMarkdownNormalize is true when the change only normalizes the initial markdown, for
example - bullets that the editor writes as * (see toMarkdownOptions).
Methods
Section titled “Methods”Bind the component to call its methods:
<script lang="ts"> import { MarkdownEditor, type MarkdownEditorMethods } from '@the-sumeet/sveltedown';
let editor: MarkdownEditorMethods;</script>
<MarkdownEditor bind:this={editor} markdown="Hello" /><button onclick={() => editor.insertMarkdown('**inserted**')}>Insert</button>See the props and methods reference for the full list.
Everything at once
Section titled “Everything at once”The home page demo enables every plugin with the KitchenSinkToolbar. The guides cover
each feature with a focused demo.