@codemirror/legacy-modes
v6.4.2
Published
Collection of ported legacy language modes for the CodeMirror code editor
Downloads
1,339,278
Readme
@codemirror/legacy-modes
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This package implements a collection of ported stream
language modes for
the CodeMirror code editor. Each mode is
available as a separate script file, under
"@codemirror/legacy-modes/mode/[name]"
, and exports the values
listed below.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
Example
Using modes from this package works like this:
Install this package and the
@codemirror/language
package.Find the
StreamParser
instance you need in the reference below.Add
StreamLanguage.define(theParser)
to your editor's configuration.
For example, to load the Lua mode, you'd do something like...
import {StreamLanguage} from "@codemirror/language"
import {lua} from "@codemirror/legacy-modes/mode/lua"
import {EditorView, basicSetup} from "codemirror"
let view = new EditorView({
extensions: [basicSetup, StreamLanguage.define(lua)]
})