Skip to content

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.

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.

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.

ImportLanguages/aliases added
abapabap
abnfabnf
actionscriptactionscript
adaada
agdaagda
alal
antlr4g4, and antlr4
apacheconfapacheconf
apexapex
aplapl
applescriptapplescript
aqlaql
arduinoino, and arduino
arffarff
arturoart, and arturo
asciidocadoc, and asciidoc
asmarm-asm, armasm, asm6502, asmatmel, and nasm
aspnetaspnet
autohotkeyautohotkey
autoitautoit
avisynthavs, and avisynth
avro-idlavdl, and avro-idl
awkawk
bashsh, shell, and bash
basicbasic
batchbatch
bbjbbj
bicepbicep
birbbirb
bisonbison
bqnbqn
brightscriptbrightscript
brobro
bslbsl
cfscriptcfscript
chaiscriptchaiscript
cilcil
cilkcilk-c, cilkc, cilk, cilk-cpp, and cilkcpp
clikeclike, js, javascript, ts, typescript, java, cs, csharp, c, cpp, go, d, dart, flow, and haxe
clojureclojure
cmakecmake
cobolcobol
coffeescriptcoffee, and coffeescript
concurnasconc, and concurnas
cooklangcooklang
coqcoq
cshtmlrazor, and cshtml
csscss, less, scss, and sass
cuecue
cyphercypher
dataweavedataweave
daxdax
dhalldhall
djangojinja2, and django
dns-zone-filedns-zone, and dns-zone-file
dockerdockerfile, and docker
dotgv, and dot
ebnfebnf
editorconfigeditorconfig
eiffeleiffel
ejsejs
elixirelixir
elmelm
erberb
erlangerlang
etluaetlua
excel-formulaxlsx, xls, and excel-formula
factorfactor
falsefalse
firestore-security-rulesfirestore-security-rules
fortranfortran
fsharpfsharp
ftlftl
gapgap
gcodegcode
gdscriptgdscript
gettextgettext
gherkingherkin
gitgit
glslglsl, and hlsl
gmlgamemakerlanguage, and gml
gngni, and gn
go-modulego-mod, and go-module
gradlegradle
graphqlgraphql
groovygroovy
hamlhaml
handlebarsmustache, hbs, and handlebars
haskellidr, idris, hs, haskell, purs, and purescript
hclhcl
hoonhoon
htmlmarkup, html, markdown, and md
ichigojamichigojam
iconicon
iecstiecst
ignorenpmignore, hgignore, gitignore, and ignore
inform7inform7
iniini
ioio
jj
joliejolie
jqjq
jsonjson, json5, and jsonp
jsxjsx, and tsx
juliajulia
keepalivedkeepalived
keymankeyman
kotlinkts, kt, and kotlin
kumirkumir
kustokusto
latexcontext, tex, and latex
lattelatte
lilypondly, and lilypond
linker-scriptld, and linker-script
liquidliquid
lispemacs-lisp, emacs, elisp, and lisp
livescriptlivescript
llvmllvm
lolcodelolcode
lualua
magmamagma
makefilemakefile
matamata
matlabmatlab
maxscriptmaxscript
melmel
mermaidmermaid
metafontmetafont
mizarmizar
mongodbmongodb
monkeymonkey
moonscriptmoon, and moonscript
n1qln1ql
n4jsn4jsd, and n4js
nand2tetris-hdlnand2tetris-hdl
naniscriptnani, and naniscript
neonneon
nevodnevod
nginxnginx
nimnim
nixnix
nsisnsis
objectivecobjc, and objectivec
ocamlocaml
odinodin
openclopencl
openqasmqasm, and openqasm
ozoz
parigpparigp
parserparser
pascalpascaligo, objectpascal, and pascal
peoplecodepcode, and peoplecode
perlperl
phpphp
plant-umlplantuml, and plant-uml
powerquerymscript, pq, and powerquery
powershellpowershell
processingprocessing
prologprolog
promqlpromql
propertiesproperties
protobufprotobuf
pslpsl
pugpug
puppetpuppet
purepure
purebasicpbfasm, and purebasic
pythonrpy, renpy, py, and python
qq
qmlqml
qoreqore
qsharpqs, and qsharp
rr
reasonreason
regorego
rescriptres, and rescript
restrest
riprip
roboconfroboconf
robotframeworkrobot, and robotframework
rubycrystal, rb, and ruby
rustrust
sassas
scalascala
schemeracket, and scheme
smalismali
smalltalksmalltalk
smartysmarty
smlsmlnj, and sml
soliditysol, and solidity
solution-filesln, and solution-file
soysoy
splunk-splsplunk-spl
sqfsqf
sqlplsql, and sql
squirrelsquirrel
stanstan
statastata
stylusstylus
supercollidersclang, and supercollider
swiftswift
systemdsystemd
tcltcl
textiletextile
tomltoml
tremortrickle, troy, and tremor
tt2tt2
turtlerq, sparql, trig, and turtle
twigtwig
typoscripttsconfig, and typoscript
unrealscriptuc, uscript, and unrealscript
uorazoruorazor
vv
valavala
vbnetvbnet
velocityvelocity
verilogverilog
vhdlvhdl
vimvim
visual-basicvba, vb, and visual-basic
warpscriptwarpscript
wasmwasm
web-idlwebidl, and web-idl
wgslwgsl
wikiwiki
wolframnb, wl, mathematica, and wolfram
wrenwren
xeoraxeoracube, and xeora
xmlxml, ssml, atom, rss, mathml, and svg
xojoxojo
xqueryxquery
yamlyml, and yaml
yangyang
zigzig

To define your own behavior, simply mutate the languageMap. See Language for the available properties.