Language Specific Behavior
If you’re not using the setups, automatic indentation, toggling comments, and automatic closing of tags won’t work. You’ll need to import the behavior or define it yourself.
Importing
Section titled “Importing”The easiest way to get this working, is to import all languages from prism-code-editor/languages. This will add comment toggling, and automatic indentation to almost all languages Prism supports at ~3.6kB gzipped. Since this behavior isn’t needed before the page has loaded, a dynamic import() could be used. If you have async JavaScript chunks, you can include the import there instead.
Alternatively, you can import the entry point prism-code-editor/languages/common, which adds the behavior for a subset of common languages instead at <2kB gzipped.
Individual imports
Section titled “Individual imports”Lastly, if you know exactly which languages you need, you can import behavior for individual languages. Refer to the list below for which imports adds the behavior to which language(s).
List of all imports
The import for ada would be prism-code-editor/languages/ada for example. This list is not for Prism grammars.
| Import | Languages/aliases added |
|---|---|
abap | abap |
abnf | abnf |
actionscript | actionscript |
ada | ada |
agda | agda |
al | al |
antlr4 | g4, and antlr4 |
apacheconf | apacheconf |
apex | apex |
apl | apl |
applescript | applescript |
aql | aql |
arduino | ino, and arduino |
arff | arff |
arturo | art, and arturo |
asciidoc | adoc, and asciidoc |
asm | arm-asm, armasm, asm6502, asmatmel, and nasm |
aspnet | aspnet |
autohotkey | autohotkey |
autoit | autoit |
avisynth | avs, and avisynth |
avro-idl | avdl, and avro-idl |
awk | awk |
bash | sh, shell, and bash |
basic | basic |
batch | batch |
bbj | bbj |
bicep | bicep |
birb | birb |
bison | bison |
bqn | bqn |
brightscript | brightscript |
bro | bro |
bsl | bsl |
cfscript | cfscript |
chaiscript | chaiscript |
cil | cil |
cilk | cilk-c, cilkc, cilk, cilk-cpp, and cilkcpp |
clike | clike, js, javascript, ts, typescript, java, cs, csharp, c, cpp, go, d, dart, flow, and haxe |
clojure | clojure |
cmake | cmake |
cobol | cobol |
coffeescript | coffee, and coffeescript |
concurnas | conc, and concurnas |
cooklang | cooklang |
coq | coq |
cshtml | razor, and cshtml |
css | css, less, scss, and sass |
cue | cue |
cypher | cypher |
dataweave | dataweave |
dax | dax |
dhall | dhall |
django | jinja2, and django |
dns-zone-file | dns-zone, and dns-zone-file |
docker | dockerfile, and docker |
dot | gv, and dot |
ebnf | ebnf |
editorconfig | editorconfig |
eiffel | eiffel |
ejs | ejs |
elixir | elixir |
elm | elm |
erb | erb |
erlang | erlang |
etlua | etlua |
excel-formula | xlsx, xls, and excel-formula |
factor | factor |
false | false |
firestore-security-rules | firestore-security-rules |
fortran | fortran |
fsharp | fsharp |
ftl | ftl |
gap | gap |
gcode | gcode |
gdscript | gdscript |
gettext | gettext |
gherkin | gherkin |
git | git |
glsl | glsl, and hlsl |
gml | gamemakerlanguage, and gml |
gn | gni, and gn |
go-module | go-mod, and go-module |
gradle | gradle |
graphql | graphql |
groovy | groovy |
haml | haml |
handlebars | mustache, hbs, and handlebars |
haskell | idr, idris, hs, haskell, purs, and purescript |
hcl | hcl |
hoon | hoon |
html | markup, html, markdown, and md |
ichigojam | ichigojam |
icon | icon |
iecst | iecst |
ignore | npmignore, hgignore, gitignore, and ignore |
inform7 | inform7 |
ini | ini |
io | io |
j | j |
jolie | jolie |
jq | jq |
json | json, json5, and jsonp |
jsx | jsx, and tsx |
julia | julia |
keepalived | keepalived |
keyman | keyman |
kotlin | kts, kt, and kotlin |
kumir | kumir |
kusto | kusto |
latex | context, tex, and latex |
latte | latte |
lilypond | ly, and lilypond |
linker-script | ld, and linker-script |
liquid | liquid |
lisp | emacs-lisp, emacs, elisp, and lisp |
livescript | livescript |
llvm | llvm |
lolcode | lolcode |
lua | lua |
magma | magma |
makefile | makefile |
mata | mata |
matlab | matlab |
maxscript | maxscript |
mel | mel |
mermaid | mermaid |
metafont | metafont |
mizar | mizar |
mongodb | mongodb |
monkey | monkey |
moonscript | moon, and moonscript |
n1ql | n1ql |
n4js | n4jsd, and n4js |
nand2tetris-hdl | nand2tetris-hdl |
naniscript | nani, and naniscript |
neon | neon |
nevod | nevod |
nginx | nginx |
nim | nim |
nix | nix |
nsis | nsis |
objectivec | objc, and objectivec |
ocaml | ocaml |
odin | odin |
opencl | opencl |
openqasm | qasm, and openqasm |
oz | oz |
parigp | parigp |
parser | parser |
pascal | pascaligo, objectpascal, and pascal |
peoplecode | pcode, and peoplecode |
perl | perl |
php | php |
plant-uml | plantuml, and plant-uml |
powerquery | mscript, pq, and powerquery |
powershell | powershell |
processing | processing |
prolog | prolog |
promql | promql |
properties | properties |
protobuf | protobuf |
psl | psl |
pug | pug |
puppet | puppet |
pure | pure |
purebasic | pbfasm, and purebasic |
python | rpy, renpy, py, and python |
q | q |
qml | qml |
qore | qore |
qsharp | qs, and qsharp |
r | r |
reason | reason |
rego | rego |
rescript | res, and rescript |
rest | rest |
rip | rip |
roboconf | roboconf |
robotframework | robot, and robotframework |
ruby | crystal, rb, and ruby |
rust | rust |
sas | sas |
scala | scala |
scheme | racket, and scheme |
smali | smali |
smalltalk | smalltalk |
smarty | smarty |
sml | smlnj, and sml |
solidity | sol, and solidity |
solution-file | sln, and solution-file |
soy | soy |
splunk-spl | splunk-spl |
sqf | sqf |
sql | plsql, and sql |
squirrel | squirrel |
stan | stan |
stata | stata |
stylus | stylus |
supercollider | sclang, and supercollider |
swift | swift |
systemd | systemd |
tcl | tcl |
textile | textile |
toml | toml |
tremor | trickle, troy, and tremor |
tt2 | tt2 |
turtle | rq, sparql, trig, and turtle |
twig | twig |
typoscript | tsconfig, and typoscript |
unrealscript | uc, uscript, and unrealscript |
uorazor | uorazor |
v | v |
vala | vala |
vbnet | vbnet |
velocity | velocity |
verilog | verilog |
vhdl | vhdl |
vim | vim |
visual-basic | vba, vb, and visual-basic |
warpscript | warpscript |
wasm | wasm |
web-idl | webidl, and web-idl |
wgsl | wgsl |
wiki | wiki |
wolfram | nb, wl, mathematica, and wolfram |
wren | wren |
xeora | xeoracube, and xeora |
xml | xml, ssml, atom, rss, mathml, and svg |
xojo | xojo |
xquery | xquery |
yaml | yml, and yaml |
yang | yang |
zig | zig |
Defining your own
Section titled “Defining your own”To define your own behavior, simply mutate the languageMap. See Language for the available properties.