@nuxtlabs/monarch-mdc
v0.2.0
Published
Integrate MDC syntax with Monaco Editor
Downloads
93
Readme
@nuxtlabs/monarch-mdc
Integrate MDC syntax with Monaco Editor.
Installation
#using yarn
yarn add @nuxtlabs/monarch-mdc
# using npm
npm install @nuxtlabs/monarch-mdc
Usage
import * as monaco from 'monaco-editor'
import { language as markdownLanguage } from '@nuxtlabs/monarch-mdc'
// Register language
monaco.languages.register({ id: 'docus-markdown' })
monaco.languages.setMonarchTokensProvider('docus-markdown', markdownLanguage);
const code = `
Your **awesome** markdown
`
// Create monaco model
const model = monaco.editor.createModel(
code,
'docus-markdown'
)
// Create your editor
const el = ... // DOM element
const editor = monaco.editor.create(el, {
model,
// Monaco edito options
// see: https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandaloneeditorconstructionoptions.html
})