Function: codeMirrorPlugin()
codeMirrorPlugin(
params?):RealmPlugin
A plugin that adds lets users edit code blocks with CodeMirror.
Parameters
| Parameter | Type | Description |
|---|---|---|
params? | object | - |
params.autoLoadLanguageSupport? | boolean | Whether or not to try to dynamically load the code block language support. Disable if you want to manually pass the supported languages. |
params.codeBlockLanguages? | Record<string, string> | CodeBlockLanguage[] | The code block languages to display in the language select dropdown. Accepts either a Record<string, string> (key → label) for backwards compatibility, or an array of CodeBlockLanguage objects (compatible with CodeMirror's LanguageDescription from @codemirror/language-data), which supports aliases and file extensions. |
params.codeMirrorExtensions? | Extension[] | Optional, additional CodeMirror extensions to load in the diff/source mode. |