@singapore-editor/markdown
v0.2.15
Published
Markdown preview and editing commands for the Singapore editor.
Maintainers
Readme
@singapore-editor/markdown
Markdown preview and editing commands for the Singapore editor.
Part of Singapore. A code editor for the browser that keeps every version.
Install
npm install @singapore-editor/core @singapore-editor/markdown @singapore-editor/tree-sitter @singapore-editor/tree-sitter-languagesUsage
import { Editor } from '@singapore-editor/core/editor'
import { markdown } from '@singapore-editor/tree-sitter-languages/markdown'
import {
createMarkdownAuthoringPlugin,
createMarkdownPreviewPlugin,
} from '@singapore-editor/markdown'
const host = document.createElement('div')
host.style.height = '400px'
document.body.append(host)
const editor = new Editor(host, {
plugins: [markdown(), createMarkdownPreviewPlugin(), createMarkdownAuthoringPlugin()],
})
editor.openDocument({
documentId: 'notes.md',
text: '# Notes\n\nsome **bold** text\n',
languageId: 'markdown',
})Requirements
Tree-sitter and native Markdown parsing need Chromium 144, Firefox 145, Safari 26.2, or newer, and Node.js 26.0.0 or Bun 1.2.22 or newer for parser calls outside a browser. The parser uses WebAssembly.Memory.prototype.toResizableBuffer(), and those are the first versions that support it.
API highlights
createMarkdownPreviewPlugin()renders formatted Markdown over the source.createMarkdownAuthoringPlugin()adds editing commands.
In the Singapore family
@singapore-editor/core owns the editor view. This optional package adds Markdown display and commands. Choose the other plugins your app needs.
Singapore README · Documentation
License
MIT. License
