Implement the Syncfusion Vue Markdown Converter to convert Markdown text into clean HTML. Use this when converting Markdown to HTML in Vue, integrating a live Markdown preview, configuring GFM or line break options, or working with MarkdownConverter.toHtml() and MarkdownConverterOptions. This skill covers the @syncfusion/ej2-markdown-converter package and Markdown Editor integration with side-by-side HTML preview.
The Syncfusion Vue Markdown Converter is a lightweight utility that transforms Markdown-formatted text into clean, semantic HTML. It is typically used alongside the Syncfusion Rich Text Editor (in Markdown mode) to provide a live preview of rendered content.
MarkdownConverter.toHtml() with the Syncfusion Rich Text Editor📄 Read: references/getting-started.md
@syncfusion/ej2-markdown-converter and @syncfusion/ej2-vue-richtexteditor📄 Read: references/tohtml-api.md
MarkdownConverter.toHtml() method signatureMarkdownConverterOptions interfaceasync — asynchronous conversion for large contentgfm — GitHub Flavored Markdown support (default: true)lineBreak — convert single line breaks to <br> (default: false)silence — suppress errors on invalid Markdown (default: false)toHtml()ejs-richtexteditor in Markdown editorModeonChange and updateValue()MarkdownFormatter for custom Markdown syntaxBrowser.isDeviceInstall packages and wire up the converter in three steps:
1. Install packages:
npm install @syncfusion/ej2-markdown-converter
npm install @syncfusion/ej2-vue-richtexteditor
2. Import CSS in src/App.vue or src/main.js:
import '@syncfusion/ej2-base/styles/material3.css';
import '@syncfusion/ej2-richtexteditor/styles/material3.css';
3. Convert Markdown to HTML:
import { MarkdownConverter } from '@syncfusion/ej2-markdown-converter';
const markdown = '# Hello World\nThis is **Markdown** text.';
const html = MarkdownConverter.toHtml(markdown);
console.log(html);
// Output: <h1>Hello World</h1><p>This is <strong>Markdown</strong> text.</p>
When you only need to convert a Markdown string to HTML without an editor UI:
import { MarkdownConverter } from '@syncfusion/ej2-markdown-converter';
const html = MarkdownConverter.toHtml(markdownString);
document.getElementById('preview').innerHTML = html;
Convert on every keystroke inside a Rich Text Editor textarea:
markDownConversion() {
const textarea = this.rteObj.contentModule.getEditPanel();
const previewEl = document.getElementById('html-view');
previewEl.innerHTML = MarkdownConverter.toHtml(textarea.value);
}
Disable GFM and enable line-break conversion:
const html = MarkdownConverter.toHtml(markdownString, {
gfm: false,
lineBreak: true
});
For a full editor + preview experience, use the Syncfusion Splitter component alongside the Rich Text Editor in Markdown mode. The preview pane is updated via updateValue() on every change event.
📄 Read: references/richtexteditor-integration.md for the full implementation.
| API | Type | Default | Purpose |
|---|---|---|---|
MarkdownConverter.toHtml(content, options?) | static method | — | Converts Markdown string to HTML |
options.async | boolean | false | Async conversion for large content |
options.gfm | boolean | true | GitHub Flavored Markdown support |
options.lineBreak | boolean | false | Single line breaks → <br> |
options.silence | boolean | false | Suppress errors on invalid Markdown |