@codemirror/legacy-modes
TypeScript icon, indicating that this package has built-in type declarations

6.4.0 • Public • Published

@codemirror/legacy-modes NPM version

[ 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)]
})

API Reference

mode/apl

apl: StreamParser<unknown>
asciiArmor: StreamParser<unknown>

mode/asn1

asn1(conf: {keywords⁠?: Object<any>, cmipVerbs⁠?: Object<any>, compareTypes⁠?: Object<any>, status⁠?: Object<any>, tags⁠?: Object<any>, storage⁠?: Object<any>, modifier⁠?: Object<any>, accessTypes⁠?: Object<any>, multiLineStrings⁠?: boolean}) → StreamParser<unknown>

mode/asterisk

asterisk: StreamParser<unknown>

mode/brainfuck

brainfuck: StreamParser<unknown>

mode/clike

clike(conf: {name: string, statementIndentUnit⁠?: number, dontAlignCalls⁠?: boolean, keywords⁠?: Object<any>, types⁠?: Object<any>, builtin⁠?: Object<any>, blockKeywords⁠?: Object<any>, atoms⁠?: Object<any>, hooks⁠?: Object<any>, multiLineStrings⁠?: boolean, indentStatements⁠?: boolean, indentSwitch⁠?: boolean, namespaceSeparator⁠?: string, isPunctuationChar⁠?: RegExp, numberStart⁠?: RegExp, number⁠?: RegExp, isOperatorChar⁠?: RegExp, isIdentifierChar⁠?: RegExp, isReservedIdentifier⁠?: fn(idstring) → boolean}) → StreamParser<unknown>
c: StreamParser<unknown>
cpp: StreamParser<unknown>
java: StreamParser<unknown>
csharp: StreamParser<unknown>
scala: StreamParser<unknown>
kotlin: StreamParser<unknown>
shader: StreamParser<unknown>
nesC: StreamParser<unknown>
objectiveC: StreamParser<unknown>
objectiveCpp: StreamParser<unknown>
squirrel: StreamParser<unknown>
ceylon: StreamParser<unknown>
dart: StreamParser<unknown>

mode/clojure

clojure: StreamParser<unknown>

mode/cmake

cmake: StreamParser<unknown>

mode/cobol

cobol: StreamParser<unknown>
coffeeScript: StreamParser<unknown>
commonLisp: StreamParser<unknown>

mode/crystal

crystal: StreamParser<unknown>

mode/css

css: StreamParser<unknown>
sCSS: StreamParser<unknown>
less: StreamParser<unknown>
gss: StreamParser<unknown>

mode/cypher

cypher: StreamParser<unknown>

mode/d

d: StreamParser<unknown>

mode/diff

diff: StreamParser<unknown>
dockerFile: StreamParser<unknown>

mode/dtd

dtd: StreamParser<unknown>

mode/dylan

dylan: StreamParser<unknown>

mode/ebnf

ebnf: StreamParser<unknown>

mode/ecl

ecl: StreamParser<unknown>

mode/eiffel

eiffel: StreamParser<unknown>

mode/elm

elm: StreamParser<unknown>

mode/erlang

erlang: StreamParser<unknown>

mode/factor

factor: StreamParser<unknown>

mode/fcl

fcl: StreamParser<unknown>

mode/forth

forth: StreamParser<unknown>

mode/fortran

fortran: StreamParser<unknown>

mode/gas

gas: StreamParser<unknown>
gasArm: StreamParser<unknown>

mode/gherkin

gherkin: StreamParser<unknown>

mode/go

go: StreamParser<unknown>

mode/groovy

groovy: StreamParser<unknown>

mode/haskell

haskell: StreamParser<unknown>

mode/haxe

haxe: StreamParser<unknown>
hxml: StreamParser<unknown>

mode/http

http: StreamParser<unknown>

mode/idl

idl: StreamParser<unknown>
javascript: StreamParser<unknown>
json: StreamParser<unknown>
jsonld: StreamParser<unknown>
typescript: StreamParser<unknown>

mode/jinja2

jinja2: StreamParser<unknown>

mode/julia

julia: StreamParser<unknown>
liveScript: StreamParser<unknown>

mode/lua

lua: StreamParser<unknown>
mathematica: StreamParser<unknown>

mode/mbox

mbox: StreamParser<unknown>

mode/mirc

mirc: StreamParser<unknown>

mode/mllike

oCaml: StreamParser<unknown>
fSharp: StreamParser<unknown>
sml: StreamParser<unknown>

mode/modelica

modelica: StreamParser<unknown>

mode/mscgen

mscgen: StreamParser<unknown>
msgenny: StreamParser<unknown>
xu: StreamParser<unknown>

mode/mumps

mumps: StreamParser<unknown>

mode/nginx

nginx: StreamParser<unknown>

mode/nsis

nsis: StreamParser<unknown>

mode/ntriples

ntriples: StreamParser<unknown>

mode/octave

octave: StreamParser<unknown>

mode/oz

oz: StreamParser<unknown>

mode/pascal

pascal: StreamParser<unknown>

mode/pegjs

pegjs: StreamParser<unknown>

mode/perl

perl: StreamParser<unknown>

mode/pig

pig: StreamParser<unknown>
powerShell: StreamParser<unknown>
properties: StreamParser<unknown>

mode/protobuf

protobuf: StreamParser<unknown>

mode/pug

pug: StreamParser<unknown>

mode/puppet

puppet: StreamParser<unknown>

mode/python

python: StreamParser<unknown>
cython: StreamParser<unknown>

mode/q

q: StreamParser<unknown>

mode/r

r: StreamParser<unknown>

mode/rpm

rpmChanges: StreamParser<unknown>
rpmSpec: StreamParser<unknown>

mode/ruby

ruby: StreamParser<unknown>

mode/rust

rust: StreamParser<unknown>

mode/sas

sas: StreamParser<unknown>

mode/sass

sass: StreamParser<unknown>

mode/scheme

scheme: StreamParser<unknown>

mode/shell

shell: StreamParser<unknown>

mode/sieve

sieve: StreamParser<unknown>

interface Rule

regex⁠?: string | RegExp | undefined
token⁠?: string | string[] | fn(matchesRegExpMatchArray) → string | string[] | null | null | undefined
sol⁠?: boolean
next⁠?: string
push⁠?: string
pop⁠?: boolean
indent⁠?: boolean
dedent⁠?: boolean
dedentIfLineStart⁠?: boolean
simpleMode<K extends string>(states: {[P in K]: P extends "languageData" ? Object<any> : Rule[]} & {start: Rule[]}) → StreamParser<unknown>

mode/smalltalk

smalltalk: StreamParser<unknown>

mode/solr

solr: StreamParser<unknown>

mode/sparql

sparql: StreamParser<unknown>
spreadsheet: StreamParser<unknown>

mode/sql

sql(conf: {client⁠?: Object<any>, atoms⁠?: Object<any>, builtin⁠?: Object<any>, keywords⁠?: Object<any>, operatorChars⁠?: RegExp, support⁠?: Object<any>, hooks⁠?: Object<any>, dateSQL⁠?: Object<any>, backslashStringEscapes⁠?: boolean, brackets⁠?: RegExp, punctuation⁠?: RegExp}) → StreamParser<unknown>
standardSQL: StreamParser<unknown>
msSQL: StreamParser<unknown>
mySQL: StreamParser<unknown>
mariaDB: StreamParser<unknown>
sqlite: StreamParser<unknown>
cassandra: StreamParser<unknown>
plSQL: StreamParser<unknown>
hive: StreamParser<unknown>
pgSQL: StreamParser<unknown>
gql: StreamParser<unknown>
gpSQL: StreamParser<unknown>
sparkSQL: StreamParser<unknown>
esper: StreamParser<unknown>

mode/stex

stex: StreamParser<unknown>
stexMath: StreamParser<unknown>

mode/stylus

stylus: StreamParser<unknown>

mode/swift

swift: StreamParser<unknown>

mode/tcl

tcl: StreamParser<unknown>

mode/textile

textile: StreamParser<unknown>
tiddlyWiki: StreamParser<unknown>

mode/tiki

tiki: StreamParser<unknown>

mode/toml

toml: StreamParser<unknown>

mode/troff

troff: StreamParser<unknown>

mode/ttcn-cfg

ttcnCfg: StreamParser<unknown>

mode/ttcn

ttcn: StreamParser<unknown>

mode/turtle

turtle: StreamParser<unknown>

mode/vb

vb: StreamParser<unknown>

mode/vbscript

vbScript: StreamParser<unknown>
vbScriptASP: StreamParser<unknown>

mode/velocity

velocity: StreamParser<unknown>

mode/verilog

verilog: StreamParser<unknown>
tlv: StreamParser<unknown>

mode/vhdl

vhdl: StreamParser<unknown>

mode/wast

wast: StreamParser<unknown>

mode/webidl

webIDL: StreamParser<unknown>

mode/xml

xml: StreamParser<unknown>
html: StreamParser<unknown>

mode/xquery

xQuery: StreamParser<unknown>

mode/yacas

yacas: StreamParser<unknown>

mode/yaml

yaml: StreamParser<unknown>

mode/z80

z80: StreamParser<unknown>
ez80: StreamParser<unknown>

Readme

Keywords

Package Sidebar

Install

npm i @codemirror/legacy-modes

Weekly Downloads

246,581

Version

6.4.0

License

MIT

Unpacked Size

1.96 MB

Total Files

316

Last publish

Collaborators

  • adrianheine
  • marijn