source: node_modules/refractor/readme.md@ 65b6638

main
Last change on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 31.5 KB
Line 
1# refractor
2
3[![Build][build-badge]][build]
4[![Coverage][coverage-badge]][coverage]
5[![Downloads][downloads-badge]][downloads]
6[![Size][size-badge]][size]
7
8Lightweight, robust, elegant virtual syntax highlighting using [Prism][].
9Useful for virtual DOMs and non-HTML things.
10Perfect for [React][], [VDOM][], and others.
11
12<!--count start-->
13
14`refractor` is built to work with all syntaxes supported by [Prism][],
15that’s [277 languages][names] (as of [`prism@1.27.0`][prismjs]) and all
16[themes][].
17
18<!--count end-->
19
20Want to use [`highlight.js`][hljs] instead?
21Try [`lowlight`][lowlight]!
22
23## Contents
24
25* [Install](#install)
26* [Use](#use)
27* [API](#api)
28 * [`refractor.register(syntax)`](#refractorregistersyntax)
29 * [`refractor.alias(name[, alias])`](#refractoraliasname-alias)
30 * [`refractor.highlight(value, language)`](#refractorhighlightvalue-language)
31 * [`refractor.registered(language)`](#refractorregisteredlanguage)
32 * [`refractor.listLanguages()`](#refractorlistlanguages)
33* [Browser](#browser)
34* [Plugins](#plugins)
35* [Syntaxes](#syntaxes)
36* [Related](#related)
37* [Projects](#projects)
38
39## Install
40
41[npm][]:
42
43```sh
44npm install refractor
45```
46
47[Use in the browser »][browser]
48
49## Use
50
51```js
52var refractor = require('refractor')
53
54var nodes = refractor.highlight('"use strict";', 'js')
55
56console.log(nodes)
57```
58
59Yields:
60
61```js
62[
63 {
64 type: 'element',
65 tagName: 'span',
66 properties: {className: ['token', 'string']},
67 children: [{type: 'text', value: '"use strict"'}]
68 },
69 {
70 type: 'element',
71 tagName: 'span',
72 properties: {className: ['token', 'punctuation']},
73 children: [{type: 'text', value: ';'}]
74 }
75]
76```
77
78Which serialized with [`rehype`][rehype] or [`hast-util-to-html`][to-html]
79yields (you may have to wrap it into a fragment like so: `{type: 'root',
80children: nodes}`):
81
82```html
83<span class="token string">"use strict"</span><span class="token punctuation">;</span>
84```
85
86> **Tip**: Use [`hast-to-hyperscript`][to-hyperscript] to transform to other
87> virtual DOMs, or DIY.
88
89## API
90
91### `refractor.register(syntax)`
92
93Register a [syntax][].
94Needed if you’re using [`refractor/core`][browser].
95
96###### Example
97
98```js
99var refractor = require('refractor/core')
100var markdown = require('refractor/lang/markdown')
101
102refractor.register(markdown)
103
104console.log(refractor.highlight('*Emphasis*', 'markdown'))
105```
106
107Yields:
108
109```js
110[
111 {
112 type: 'element',
113 tagName: 'span',
114 properties: {className: [Array]},
115 children: [[Object], [Object], [Object]]
116 }
117]
118```
119
120### `refractor.alias(name[, alias])`
121
122Register a new `alias` for the `name` language.
123
124###### Signatures
125
126* `alias(name, alias|list)`
127* `alias(aliases)`
128
129###### Parameters
130
131* `name` (`string`) — [Name][names] of a registered language
132* `alias` (`string`) — New alias for the registered language
133* `list` (`Array.<alias>`) — List of aliases
134* `aliases` (`Object.<alias|list>`) — Map where each key is a `name` and each
135 value an `alias` or a `list`
136
137###### Example
138
139```js
140var refractor = require('refractor/core')
141var markdown = require('refractor/lang/markdown')
142
143refractor.register(markdown)
144
145// refractor.highlight('*Emphasis*', 'mdown')
146// ^ would throw: Error: Unknown language: `mdown` is not registered
147
148refractor.alias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
149refractor.highlight('*Emphasis*', 'mdown')
150// ^ Works!
151```
152
153### `refractor.highlight(value, language)`
154
155Parse `value` (`string`) according to the `language` ([name or alias][syntax])
156syntax.
157
158###### Returns
159
160Virtual nodes representing the highlighted value ([`Array.<Node>`][node]).
161
162###### Example
163
164```js
165var refractor = require('refractor/core')
166
167console.log(refractor.highlight('em { color: red }', 'css'))
168```
169
170Yields:
171
172```js
173[
174 {
175 type: 'element',
176 tagName: 'span',
177 properties: {className: [Array]},
178 children: [[Object]]
179 },
180 {type: 'text', value: ' '},
181 // …
182 {type: 'text', value: ' red '},
183 {
184 type: 'element',
185 tagName: 'span',
186 properties: {className: [Array]},
187 children: [[Object]]
188 }
189]
190```
191
192### `refractor.registered(language)`
193
194Check if a `language` ([name or alias][syntax]) is registered.
195
196###### Example
197
198```js
199var refractor = require('refractor/core')
200var markdown = require('refractor/lang/markdown')
201
202console.log(refractor.registered('markdown'))
203
204refractor.register(markdown)
205
206console.log(refractor.registered('markdown'))
207```
208
209Yields:
210
211```js
212false
213true
214```
215
216### `refractor.listLanguages()`
217
218List all registered languages ([names and aliases][syntax]).
219
220###### Returns
221
222`Array.<string>`.
223
224###### Example
225
226```js
227var refractor = require('refractor/core')
228var markdown = require('refractor/lang/markdown')
229
230console.log(refractor.listLanguages())
231
232refractor.register(markdown)
233
234console.log(refractor.listLanguages())
235```
236
237Yields:
238
239```js
240[
241 'markup',
242 'html',
243 // …
244 'javascript',
245 'js'
246]
247[
248 'markup',
249 'html',
250 // …
251 'javascript',
252 'js',
253 'markdown',
254 'md'
255]
256```
257
258## Browser
259
260I do not suggest using the [pre-bundled][releases] files or requiring
261`refractor` itself in the browser as that would include a 376kb (139kb GZipped)
262of code.
263
264Instead require `refractor/core` and include only the needed syntaxes.
265For example:
266
267```js
268var refractor = require('refractor/core')
269
270refractor.register(require('refractor/lang/jsx'))
271
272console.log(refractor.highlight('<Dropdown primary />', 'jsx'))
273```
274
275Yields:
276
277```js
278[
279 {
280 type: 'element',
281 tagName: 'span',
282 properties: {className: ['token', 'tag']},
283 children: [
284 {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object], [Object]]},
285 {type: 'text', value: ' '},
286 {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object]]},
287 {type: 'text', value: ' '},
288 {type: 'element', tagName: 'span', properties: {className: [Array]}, children: [[Object]]}
289 ]
290 }
291]
292```
293
294…When using [browserify][] and minifying with [tinyify][] this results in
295just 65kb of code (23kb with GZip).
296
297## Plugins
298
299`refractor` does not support Prism plugins:
300
3011. Prism plugins often deal with the DOM, not Prism tokens
3022. Prism is made using global variables instead of a module format, so all
303 syntaxes below are custom built to work so you can `require` just what you
304 need
305
306## Syntaxes
307
308All syntaxes are included if you `require('refractor')`.
309If you’re using `refractor/core`, checked syntaxes are always included, but
310unchecked syntaxes are not and must be `require`d and [`register`][register]ed.
311
312Unlike in Prism, `cssExtras` and `phpExtras` are camel-cased instead of
313dash-cased.
314
315Only these custom built syntaxes will work with `refractor` because Prism’s own
316syntaxes are made to work with global variables and are not requirable.
317
318<!--support start-->
319
320* [x] [`clike`](https://github.com/wooorm/refractor/blob/main/lang/clike.js)
321* [x] [`css`](https://github.com/wooorm/refractor/blob/main/lang/css.js)
322* [x] [`javascript`](https://github.com/wooorm/refractor/blob/main/lang/javascript.js) — alias: `js`
323* [x] [`markup`](https://github.com/wooorm/refractor/blob/main/lang/markup.js) — alias: `html`, `mathml`, `svg`, `xml`, `ssml`, `atom`, `rss`
324* [ ] [`abap`](https://github.com/wooorm/refractor/blob/main/lang/abap.js)
325* [ ] [`abnf`](https://github.com/wooorm/refractor/blob/main/lang/abnf.js)
326* [ ] [`actionscript`](https://github.com/wooorm/refractor/blob/main/lang/actionscript.js)
327* [ ] [`ada`](https://github.com/wooorm/refractor/blob/main/lang/ada.js)
328* [ ] [`agda`](https://github.com/wooorm/refractor/blob/main/lang/agda.js)
329* [ ] [`al`](https://github.com/wooorm/refractor/blob/main/lang/al.js)
330* [ ] [`antlr4`](https://github.com/wooorm/refractor/blob/main/lang/antlr4.js) — alias: `g4`
331* [ ] [`apacheconf`](https://github.com/wooorm/refractor/blob/main/lang/apacheconf.js)
332* [ ] [`apex`](https://github.com/wooorm/refractor/blob/main/lang/apex.js)
333* [ ] [`apl`](https://github.com/wooorm/refractor/blob/main/lang/apl.js)
334* [ ] [`applescript`](https://github.com/wooorm/refractor/blob/main/lang/applescript.js)
335* [ ] [`aql`](https://github.com/wooorm/refractor/blob/main/lang/aql.js)
336* [ ] [`arduino`](https://github.com/wooorm/refractor/blob/main/lang/arduino.js) — alias: `ino`
337* [ ] [`arff`](https://github.com/wooorm/refractor/blob/main/lang/arff.js)
338* [ ] [`asciidoc`](https://github.com/wooorm/refractor/blob/main/lang/asciidoc.js) — alias: `adoc`
339* [ ] [`asm6502`](https://github.com/wooorm/refractor/blob/main/lang/asm6502.js)
340* [ ] [`asmatmel`](https://github.com/wooorm/refractor/blob/main/lang/asmatmel.js)
341* [ ] [`aspnet`](https://github.com/wooorm/refractor/blob/main/lang/aspnet.js)
342* [ ] [`autohotkey`](https://github.com/wooorm/refractor/blob/main/lang/autohotkey.js)
343* [ ] [`autoit`](https://github.com/wooorm/refractor/blob/main/lang/autoit.js)
344* [ ] [`avisynth`](https://github.com/wooorm/refractor/blob/main/lang/avisynth.js) — alias: `avs`
345* [ ] [`avroIdl`](https://github.com/wooorm/refractor/blob/main/lang/avro-idl.js)
346* [ ] [`bash`](https://github.com/wooorm/refractor/blob/main/lang/bash.js) — alias: `shell`
347* [ ] [`basic`](https://github.com/wooorm/refractor/blob/main/lang/basic.js)
348* [ ] [`batch`](https://github.com/wooorm/refractor/blob/main/lang/batch.js)
349* [ ] [`bbcode`](https://github.com/wooorm/refractor/blob/main/lang/bbcode.js) — alias: `shortcode`
350* [ ] [`bicep`](https://github.com/wooorm/refractor/blob/main/lang/bicep.js)
351* [ ] [`birb`](https://github.com/wooorm/refractor/blob/main/lang/birb.js)
352* [ ] [`bison`](https://github.com/wooorm/refractor/blob/main/lang/bison.js)
353* [ ] [`bnf`](https://github.com/wooorm/refractor/blob/main/lang/bnf.js) — alias: `rbnf`
354* [ ] [`brainfuck`](https://github.com/wooorm/refractor/blob/main/lang/brainfuck.js)
355* [ ] [`brightscript`](https://github.com/wooorm/refractor/blob/main/lang/brightscript.js)
356* [ ] [`bro`](https://github.com/wooorm/refractor/blob/main/lang/bro.js)
357* [ ] [`bsl`](https://github.com/wooorm/refractor/blob/main/lang/bsl.js)
358* [ ] [`c`](https://github.com/wooorm/refractor/blob/main/lang/c.js)
359* [ ] [`cfscript`](https://github.com/wooorm/refractor/blob/main/lang/cfscript.js)
360* [ ] [`chaiscript`](https://github.com/wooorm/refractor/blob/main/lang/chaiscript.js)
361* [ ] [`cil`](https://github.com/wooorm/refractor/blob/main/lang/cil.js)
362* [ ] [`clojure`](https://github.com/wooorm/refractor/blob/main/lang/clojure.js)
363* [ ] [`cmake`](https://github.com/wooorm/refractor/blob/main/lang/cmake.js)
364* [ ] [`cobol`](https://github.com/wooorm/refractor/blob/main/lang/cobol.js)
365* [ ] [`coffeescript`](https://github.com/wooorm/refractor/blob/main/lang/coffeescript.js) — alias: `coffee`
366* [ ] [`concurnas`](https://github.com/wooorm/refractor/blob/main/lang/concurnas.js) — alias: `conc`
367* [ ] [`coq`](https://github.com/wooorm/refractor/blob/main/lang/coq.js)
368* [ ] [`cpp`](https://github.com/wooorm/refractor/blob/main/lang/cpp.js)
369* [ ] [`crystal`](https://github.com/wooorm/refractor/blob/main/lang/crystal.js)
370* [ ] [`csharp`](https://github.com/wooorm/refractor/blob/main/lang/csharp.js) — alias: `dotnet`, `cs`
371* [ ] [`cshtml`](https://github.com/wooorm/refractor/blob/main/lang/cshtml.js) — alias: `razor`
372* [ ] [`csp`](https://github.com/wooorm/refractor/blob/main/lang/csp.js)
373* [ ] [`cssExtras`](https://github.com/wooorm/refractor/blob/main/lang/css-extras.js)
374* [ ] [`csv`](https://github.com/wooorm/refractor/blob/main/lang/csv.js)
375* [ ] [`cypher`](https://github.com/wooorm/refractor/blob/main/lang/cypher.js)
376* [ ] [`d`](https://github.com/wooorm/refractor/blob/main/lang/d.js)
377* [ ] [`dart`](https://github.com/wooorm/refractor/blob/main/lang/dart.js)
378* [ ] [`dataweave`](https://github.com/wooorm/refractor/blob/main/lang/dataweave.js)
379* [ ] [`dax`](https://github.com/wooorm/refractor/blob/main/lang/dax.js)
380* [ ] [`dhall`](https://github.com/wooorm/refractor/blob/main/lang/dhall.js)
381* [ ] [`diff`](https://github.com/wooorm/refractor/blob/main/lang/diff.js)
382* [ ] [`django`](https://github.com/wooorm/refractor/blob/main/lang/django.js) — alias: `jinja2`
383* [ ] [`dnsZoneFile`](https://github.com/wooorm/refractor/blob/main/lang/dns-zone-file.js)
384* [ ] [`docker`](https://github.com/wooorm/refractor/blob/main/lang/docker.js) — alias: `dockerfile`
385* [ ] [`dot`](https://github.com/wooorm/refractor/blob/main/lang/dot.js) — alias: `gv`
386* [ ] [`ebnf`](https://github.com/wooorm/refractor/blob/main/lang/ebnf.js)
387* [ ] [`editorconfig`](https://github.com/wooorm/refractor/blob/main/lang/editorconfig.js)
388* [ ] [`eiffel`](https://github.com/wooorm/refractor/blob/main/lang/eiffel.js)
389* [ ] [`ejs`](https://github.com/wooorm/refractor/blob/main/lang/ejs.js) — alias: `eta`
390* [ ] [`elixir`](https://github.com/wooorm/refractor/blob/main/lang/elixir.js)
391* [ ] [`elm`](https://github.com/wooorm/refractor/blob/main/lang/elm.js)
392* [ ] [`erb`](https://github.com/wooorm/refractor/blob/main/lang/erb.js)
393* [ ] [`erlang`](https://github.com/wooorm/refractor/blob/main/lang/erlang.js)
394* [ ] [`etlua`](https://github.com/wooorm/refractor/blob/main/lang/etlua.js)
395* [ ] [`excelFormula`](https://github.com/wooorm/refractor/blob/main/lang/excel-formula.js)
396* [ ] [`factor`](https://github.com/wooorm/refractor/blob/main/lang/factor.js)
397* [ ] [`$false`](https://github.com/wooorm/refractor/blob/main/lang/false.js)
398* [ ] [`firestoreSecurityRules`](https://github.com/wooorm/refractor/blob/main/lang/firestore-security-rules.js)
399* [ ] [`flow`](https://github.com/wooorm/refractor/blob/main/lang/flow.js)
400* [ ] [`fortran`](https://github.com/wooorm/refractor/blob/main/lang/fortran.js)
401* [ ] [`fsharp`](https://github.com/wooorm/refractor/blob/main/lang/fsharp.js)
402* [ ] [`ftl`](https://github.com/wooorm/refractor/blob/main/lang/ftl.js)
403* [ ] [`gap`](https://github.com/wooorm/refractor/blob/main/lang/gap.js)
404* [ ] [`gcode`](https://github.com/wooorm/refractor/blob/main/lang/gcode.js)
405* [ ] [`gdscript`](https://github.com/wooorm/refractor/blob/main/lang/gdscript.js)
406* [ ] [`gedcom`](https://github.com/wooorm/refractor/blob/main/lang/gedcom.js)
407* [ ] [`gherkin`](https://github.com/wooorm/refractor/blob/main/lang/gherkin.js)
408* [ ] [`git`](https://github.com/wooorm/refractor/blob/main/lang/git.js)
409* [ ] [`glsl`](https://github.com/wooorm/refractor/blob/main/lang/glsl.js)
410* [ ] [`gml`](https://github.com/wooorm/refractor/blob/main/lang/gml.js)
411* [ ] [`gn`](https://github.com/wooorm/refractor/blob/main/lang/gn.js) — alias: `gni`
412* [ ] [`goModule`](https://github.com/wooorm/refractor/blob/main/lang/go-module.js)
413* [ ] [`go`](https://github.com/wooorm/refractor/blob/main/lang/go.js)
414* [ ] [`graphql`](https://github.com/wooorm/refractor/blob/main/lang/graphql.js)
415* [ ] [`groovy`](https://github.com/wooorm/refractor/blob/main/lang/groovy.js)
416* [ ] [`haml`](https://github.com/wooorm/refractor/blob/main/lang/haml.js)
417* [ ] [`handlebars`](https://github.com/wooorm/refractor/blob/main/lang/handlebars.js) — alias: `hbs`
418* [ ] [`haskell`](https://github.com/wooorm/refractor/blob/main/lang/haskell.js) — alias: `hs`
419* [ ] [`haxe`](https://github.com/wooorm/refractor/blob/main/lang/haxe.js)
420* [ ] [`hcl`](https://github.com/wooorm/refractor/blob/main/lang/hcl.js)
421* [ ] [`hlsl`](https://github.com/wooorm/refractor/blob/main/lang/hlsl.js)
422* [ ] [`hoon`](https://github.com/wooorm/refractor/blob/main/lang/hoon.js)
423* [ ] [`hpkp`](https://github.com/wooorm/refractor/blob/main/lang/hpkp.js)
424* [ ] [`hsts`](https://github.com/wooorm/refractor/blob/main/lang/hsts.js)
425* [ ] [`http`](https://github.com/wooorm/refractor/blob/main/lang/http.js)
426* [ ] [`ichigojam`](https://github.com/wooorm/refractor/blob/main/lang/ichigojam.js)
427* [ ] [`icon`](https://github.com/wooorm/refractor/blob/main/lang/icon.js)
428* [ ] [`icuMessageFormat`](https://github.com/wooorm/refractor/blob/main/lang/icu-message-format.js)
429* [ ] [`idris`](https://github.com/wooorm/refractor/blob/main/lang/idris.js) — alias: `idr`
430* [ ] [`iecst`](https://github.com/wooorm/refractor/blob/main/lang/iecst.js)
431* [ ] [`ignore`](https://github.com/wooorm/refractor/blob/main/lang/ignore.js) — alias: `gitignore`, `hgignore`, `npmignore`
432* [ ] [`inform7`](https://github.com/wooorm/refractor/blob/main/lang/inform7.js)
433* [ ] [`ini`](https://github.com/wooorm/refractor/blob/main/lang/ini.js)
434* [ ] [`io`](https://github.com/wooorm/refractor/blob/main/lang/io.js)
435* [ ] [`j`](https://github.com/wooorm/refractor/blob/main/lang/j.js)
436* [ ] [`java`](https://github.com/wooorm/refractor/blob/main/lang/java.js)
437* [ ] [`javadoc`](https://github.com/wooorm/refractor/blob/main/lang/javadoc.js)
438* [ ] [`javadoclike`](https://github.com/wooorm/refractor/blob/main/lang/javadoclike.js)
439* [ ] [`javastacktrace`](https://github.com/wooorm/refractor/blob/main/lang/javastacktrace.js)
440* [ ] [`jexl`](https://github.com/wooorm/refractor/blob/main/lang/jexl.js)
441* [ ] [`jolie`](https://github.com/wooorm/refractor/blob/main/lang/jolie.js)
442* [ ] [`jq`](https://github.com/wooorm/refractor/blob/main/lang/jq.js)
443* [ ] [`jsExtras`](https://github.com/wooorm/refractor/blob/main/lang/js-extras.js)
444* [ ] [`jsTemplates`](https://github.com/wooorm/refractor/blob/main/lang/js-templates.js)
445* [ ] [`jsdoc`](https://github.com/wooorm/refractor/blob/main/lang/jsdoc.js)
446* [ ] [`json`](https://github.com/wooorm/refractor/blob/main/lang/json.js) — alias: `webmanifest`
447* [ ] [`json5`](https://github.com/wooorm/refractor/blob/main/lang/json5.js)
448* [ ] [`jsonp`](https://github.com/wooorm/refractor/blob/main/lang/jsonp.js)
449* [ ] [`jsstacktrace`](https://github.com/wooorm/refractor/blob/main/lang/jsstacktrace.js)
450* [ ] [`jsx`](https://github.com/wooorm/refractor/blob/main/lang/jsx.js)
451* [ ] [`julia`](https://github.com/wooorm/refractor/blob/main/lang/julia.js)
452* [ ] [`keepalived`](https://github.com/wooorm/refractor/blob/main/lang/keepalived.js)
453* [ ] [`keyman`](https://github.com/wooorm/refractor/blob/main/lang/keyman.js)
454* [ ] [`kotlin`](https://github.com/wooorm/refractor/blob/main/lang/kotlin.js) — alias: `kt`, `kts`
455* [ ] [`kumir`](https://github.com/wooorm/refractor/blob/main/lang/kumir.js) — alias: `kum`
456* [ ] [`kusto`](https://github.com/wooorm/refractor/blob/main/lang/kusto.js)
457* [ ] [`latex`](https://github.com/wooorm/refractor/blob/main/lang/latex.js) — alias: `tex`, `context`
458* [ ] [`latte`](https://github.com/wooorm/refractor/blob/main/lang/latte.js)
459* [ ] [`less`](https://github.com/wooorm/refractor/blob/main/lang/less.js)
460* [ ] [`lilypond`](https://github.com/wooorm/refractor/blob/main/lang/lilypond.js)
461* [ ] [`liquid`](https://github.com/wooorm/refractor/blob/main/lang/liquid.js)
462* [ ] [`lisp`](https://github.com/wooorm/refractor/blob/main/lang/lisp.js)
463* [ ] [`livescript`](https://github.com/wooorm/refractor/blob/main/lang/livescript.js)
464* [ ] [`llvm`](https://github.com/wooorm/refractor/blob/main/lang/llvm.js)
465* [ ] [`log`](https://github.com/wooorm/refractor/blob/main/lang/log.js)
466* [ ] [`lolcode`](https://github.com/wooorm/refractor/blob/main/lang/lolcode.js)
467* [ ] [`lua`](https://github.com/wooorm/refractor/blob/main/lang/lua.js)
468* [ ] [`magma`](https://github.com/wooorm/refractor/blob/main/lang/magma.js)
469* [ ] [`makefile`](https://github.com/wooorm/refractor/blob/main/lang/makefile.js)
470* [ ] [`markdown`](https://github.com/wooorm/refractor/blob/main/lang/markdown.js) — alias: `md`
471* [ ] [`markupTemplating`](https://github.com/wooorm/refractor/blob/main/lang/markup-templating.js)
472* [ ] [`matlab`](https://github.com/wooorm/refractor/blob/main/lang/matlab.js)
473* [ ] [`maxscript`](https://github.com/wooorm/refractor/blob/main/lang/maxscript.js)
474* [ ] [`mel`](https://github.com/wooorm/refractor/blob/main/lang/mel.js)
475* [ ] [`mermaid`](https://github.com/wooorm/refractor/blob/main/lang/mermaid.js)
476* [ ] [`mizar`](https://github.com/wooorm/refractor/blob/main/lang/mizar.js)
477* [ ] [`mongodb`](https://github.com/wooorm/refractor/blob/main/lang/mongodb.js)
478* [ ] [`monkey`](https://github.com/wooorm/refractor/blob/main/lang/monkey.js)
479* [ ] [`moonscript`](https://github.com/wooorm/refractor/blob/main/lang/moonscript.js) — alias: `moon`
480* [ ] [`n1ql`](https://github.com/wooorm/refractor/blob/main/lang/n1ql.js)
481* [ ] [`n4js`](https://github.com/wooorm/refractor/blob/main/lang/n4js.js) — alias: `n4jsd`
482* [ ] [`nand2tetrisHdl`](https://github.com/wooorm/refractor/blob/main/lang/nand2tetris-hdl.js)
483* [ ] [`naniscript`](https://github.com/wooorm/refractor/blob/main/lang/naniscript.js)
484* [ ] [`nasm`](https://github.com/wooorm/refractor/blob/main/lang/nasm.js)
485* [ ] [`neon`](https://github.com/wooorm/refractor/blob/main/lang/neon.js)
486* [ ] [`nevod`](https://github.com/wooorm/refractor/blob/main/lang/nevod.js)
487* [ ] [`nginx`](https://github.com/wooorm/refractor/blob/main/lang/nginx.js)
488* [ ] [`nim`](https://github.com/wooorm/refractor/blob/main/lang/nim.js)
489* [ ] [`nix`](https://github.com/wooorm/refractor/blob/main/lang/nix.js)
490* [ ] [`nsis`](https://github.com/wooorm/refractor/blob/main/lang/nsis.js)
491* [ ] [`objectivec`](https://github.com/wooorm/refractor/blob/main/lang/objectivec.js) — alias: `objc`
492* [ ] [`ocaml`](https://github.com/wooorm/refractor/blob/main/lang/ocaml.js)
493* [ ] [`opencl`](https://github.com/wooorm/refractor/blob/main/lang/opencl.js)
494* [ ] [`openqasm`](https://github.com/wooorm/refractor/blob/main/lang/openqasm.js) — alias: `qasm`
495* [ ] [`oz`](https://github.com/wooorm/refractor/blob/main/lang/oz.js)
496* [ ] [`parigp`](https://github.com/wooorm/refractor/blob/main/lang/parigp.js)
497* [ ] [`parser`](https://github.com/wooorm/refractor/blob/main/lang/parser.js)
498* [ ] [`pascal`](https://github.com/wooorm/refractor/blob/main/lang/pascal.js) — alias: `objectpascal`
499* [ ] [`pascaligo`](https://github.com/wooorm/refractor/blob/main/lang/pascaligo.js)
500* [ ] [`pcaxis`](https://github.com/wooorm/refractor/blob/main/lang/pcaxis.js) — alias: `px`
501* [ ] [`peoplecode`](https://github.com/wooorm/refractor/blob/main/lang/peoplecode.js) — alias: `pcode`
502* [ ] [`perl`](https://github.com/wooorm/refractor/blob/main/lang/perl.js)
503* [ ] [`phpExtras`](https://github.com/wooorm/refractor/blob/main/lang/php-extras.js)
504* [ ] [`php`](https://github.com/wooorm/refractor/blob/main/lang/php.js)
505* [ ] [`phpdoc`](https://github.com/wooorm/refractor/blob/main/lang/phpdoc.js)
506* [ ] [`plsql`](https://github.com/wooorm/refractor/blob/main/lang/plsql.js)
507* [ ] [`powerquery`](https://github.com/wooorm/refractor/blob/main/lang/powerquery.js)
508* [ ] [`powershell`](https://github.com/wooorm/refractor/blob/main/lang/powershell.js)
509* [ ] [`processing`](https://github.com/wooorm/refractor/blob/main/lang/processing.js)
510* [ ] [`prolog`](https://github.com/wooorm/refractor/blob/main/lang/prolog.js)
511* [ ] [`promql`](https://github.com/wooorm/refractor/blob/main/lang/promql.js)
512* [ ] [`properties`](https://github.com/wooorm/refractor/blob/main/lang/properties.js)
513* [ ] [`protobuf`](https://github.com/wooorm/refractor/blob/main/lang/protobuf.js)
514* [ ] [`psl`](https://github.com/wooorm/refractor/blob/main/lang/psl.js)
515* [ ] [`pug`](https://github.com/wooorm/refractor/blob/main/lang/pug.js)
516* [ ] [`puppet`](https://github.com/wooorm/refractor/blob/main/lang/puppet.js)
517* [ ] [`pure`](https://github.com/wooorm/refractor/blob/main/lang/pure.js)
518* [ ] [`purebasic`](https://github.com/wooorm/refractor/blob/main/lang/purebasic.js)
519* [ ] [`purescript`](https://github.com/wooorm/refractor/blob/main/lang/purescript.js) — alias: `purs`
520* [ ] [`python`](https://github.com/wooorm/refractor/blob/main/lang/python.js) — alias: `py`
521* [ ] [`q`](https://github.com/wooorm/refractor/blob/main/lang/q.js)
522* [ ] [`qml`](https://github.com/wooorm/refractor/blob/main/lang/qml.js)
523* [ ] [`qore`](https://github.com/wooorm/refractor/blob/main/lang/qore.js)
524* [ ] [`qsharp`](https://github.com/wooorm/refractor/blob/main/lang/qsharp.js) — alias: `qs`
525* [ ] [`r`](https://github.com/wooorm/refractor/blob/main/lang/r.js)
526* [ ] [`racket`](https://github.com/wooorm/refractor/blob/main/lang/racket.js) — alias: `rkt`
527* [ ] [`reason`](https://github.com/wooorm/refractor/blob/main/lang/reason.js)
528* [ ] [`regex`](https://github.com/wooorm/refractor/blob/main/lang/regex.js)
529* [ ] [`rego`](https://github.com/wooorm/refractor/blob/main/lang/rego.js)
530* [ ] [`renpy`](https://github.com/wooorm/refractor/blob/main/lang/renpy.js) — alias: `rpy`
531* [ ] [`rest`](https://github.com/wooorm/refractor/blob/main/lang/rest.js)
532* [ ] [`rip`](https://github.com/wooorm/refractor/blob/main/lang/rip.js)
533* [ ] [`roboconf`](https://github.com/wooorm/refractor/blob/main/lang/roboconf.js)
534* [ ] [`robotframework`](https://github.com/wooorm/refractor/blob/main/lang/robotframework.js)
535* [ ] [`ruby`](https://github.com/wooorm/refractor/blob/main/lang/ruby.js) — alias: `rb`
536* [ ] [`rust`](https://github.com/wooorm/refractor/blob/main/lang/rust.js)
537* [ ] [`sas`](https://github.com/wooorm/refractor/blob/main/lang/sas.js)
538* [ ] [`sass`](https://github.com/wooorm/refractor/blob/main/lang/sass.js)
539* [ ] [`scala`](https://github.com/wooorm/refractor/blob/main/lang/scala.js)
540* [ ] [`scheme`](https://github.com/wooorm/refractor/blob/main/lang/scheme.js)
541* [ ] [`scss`](https://github.com/wooorm/refractor/blob/main/lang/scss.js)
542* [ ] [`shellSession`](https://github.com/wooorm/refractor/blob/main/lang/shell-session.js)
543* [ ] [`smali`](https://github.com/wooorm/refractor/blob/main/lang/smali.js)
544* [ ] [`smalltalk`](https://github.com/wooorm/refractor/blob/main/lang/smalltalk.js)
545* [ ] [`smarty`](https://github.com/wooorm/refractor/blob/main/lang/smarty.js)
546* [ ] [`sml`](https://github.com/wooorm/refractor/blob/main/lang/sml.js) — alias: `smlnj`
547* [ ] [`solidity`](https://github.com/wooorm/refractor/blob/main/lang/solidity.js) — alias: `sol`
548* [ ] [`solutionFile`](https://github.com/wooorm/refractor/blob/main/lang/solution-file.js)
549* [ ] [`soy`](https://github.com/wooorm/refractor/blob/main/lang/soy.js)
550* [ ] [`sparql`](https://github.com/wooorm/refractor/blob/main/lang/sparql.js) — alias: `rq`
551* [ ] [`splunkSpl`](https://github.com/wooorm/refractor/blob/main/lang/splunk-spl.js)
552* [ ] [`sqf`](https://github.com/wooorm/refractor/blob/main/lang/sqf.js)
553* [ ] [`sql`](https://github.com/wooorm/refractor/blob/main/lang/sql.js)
554* [ ] [`squirrel`](https://github.com/wooorm/refractor/blob/main/lang/squirrel.js)
555* [ ] [`stan`](https://github.com/wooorm/refractor/blob/main/lang/stan.js)
556* [ ] [`stylus`](https://github.com/wooorm/refractor/blob/main/lang/stylus.js)
557* [ ] [`swift`](https://github.com/wooorm/refractor/blob/main/lang/swift.js)
558* [ ] [`systemd`](https://github.com/wooorm/refractor/blob/main/lang/systemd.js)
559* [ ] [`t4Cs`](https://github.com/wooorm/refractor/blob/main/lang/t4-cs.js)
560* [ ] [`t4Templating`](https://github.com/wooorm/refractor/blob/main/lang/t4-templating.js)
561* [ ] [`t4Vb`](https://github.com/wooorm/refractor/blob/main/lang/t4-vb.js)
562* [ ] [`tap`](https://github.com/wooorm/refractor/blob/main/lang/tap.js)
563* [ ] [`tcl`](https://github.com/wooorm/refractor/blob/main/lang/tcl.js)
564* [ ] [`textile`](https://github.com/wooorm/refractor/blob/main/lang/textile.js)
565* [ ] [`toml`](https://github.com/wooorm/refractor/blob/main/lang/toml.js)
566* [ ] [`tremor`](https://github.com/wooorm/refractor/blob/main/lang/tremor.js)
567* [ ] [`tsx`](https://github.com/wooorm/refractor/blob/main/lang/tsx.js)
568* [ ] [`tt2`](https://github.com/wooorm/refractor/blob/main/lang/tt2.js)
569* [ ] [`turtle`](https://github.com/wooorm/refractor/blob/main/lang/turtle.js)
570* [ ] [`twig`](https://github.com/wooorm/refractor/blob/main/lang/twig.js)
571* [ ] [`typescript`](https://github.com/wooorm/refractor/blob/main/lang/typescript.js) — alias: `ts`
572* [ ] [`typoscript`](https://github.com/wooorm/refractor/blob/main/lang/typoscript.js) — alias: `tsconfig`
573* [ ] [`unrealscript`](https://github.com/wooorm/refractor/blob/main/lang/unrealscript.js) — alias: `uc`, `uscript`
574* [ ] [`uorazor`](https://github.com/wooorm/refractor/blob/main/lang/uorazor.js)
575* [ ] [`uri`](https://github.com/wooorm/refractor/blob/main/lang/uri.js) — alias: `url`
576* [ ] [`v`](https://github.com/wooorm/refractor/blob/main/lang/v.js)
577* [ ] [`vala`](https://github.com/wooorm/refractor/blob/main/lang/vala.js)
578* [ ] [`vbnet`](https://github.com/wooorm/refractor/blob/main/lang/vbnet.js)
579* [ ] [`velocity`](https://github.com/wooorm/refractor/blob/main/lang/velocity.js)
580* [ ] [`verilog`](https://github.com/wooorm/refractor/blob/main/lang/verilog.js)
581* [ ] [`vhdl`](https://github.com/wooorm/refractor/blob/main/lang/vhdl.js)
582* [ ] [`vim`](https://github.com/wooorm/refractor/blob/main/lang/vim.js)
583* [ ] [`visualBasic`](https://github.com/wooorm/refractor/blob/main/lang/visual-basic.js)
584* [ ] [`warpscript`](https://github.com/wooorm/refractor/blob/main/lang/warpscript.js)
585* [ ] [`wasm`](https://github.com/wooorm/refractor/blob/main/lang/wasm.js)
586* [ ] [`webIdl`](https://github.com/wooorm/refractor/blob/main/lang/web-idl.js)
587* [ ] [`wiki`](https://github.com/wooorm/refractor/blob/main/lang/wiki.js)
588* [ ] [`wolfram`](https://github.com/wooorm/refractor/blob/main/lang/wolfram.js) — alias: `mathematica`, `wl`, `nb`
589* [ ] [`wren`](https://github.com/wooorm/refractor/blob/main/lang/wren.js)
590* [ ] [`xeora`](https://github.com/wooorm/refractor/blob/main/lang/xeora.js) — alias: `xeoracube`
591* [ ] [`xmlDoc`](https://github.com/wooorm/refractor/blob/main/lang/xml-doc.js)
592* [ ] [`xojo`](https://github.com/wooorm/refractor/blob/main/lang/xojo.js)
593* [ ] [`xquery`](https://github.com/wooorm/refractor/blob/main/lang/xquery.js)
594* [ ] [`yaml`](https://github.com/wooorm/refractor/blob/main/lang/yaml.js) — alias: `yml`
595* [ ] [`yang`](https://github.com/wooorm/refractor/blob/main/lang/yang.js)
596* [ ] [`zig`](https://github.com/wooorm/refractor/blob/main/lang/zig.js)
597
598<!--support end-->
599
600## Related
601
602* [`lowlight`][lowlight] — Same, but based on [`highlight.js`][hljs]
603
604## Projects
605
606* [`react-syntax-highlighter`](https://github.com/conorhastings/react-syntax-highlighter)
607 — [React][] component for syntax highlighting
608* [`rehype-prism`](https://github.com/mapbox/rehype-prism)
609 — Syntax highlighting in [**rehype**](https://github.com/rehypejs/rehype)
610* [`react-refractor`](https://github.com/rexxars/react-refractor)
611 — Syntax highlighter for [React][]
612
613## License
614
615[MIT][license] © [Titus Wormer][author]
616
617<!-- Definitions -->
618
619[build-badge]: https://github.com/wooorm/refractor/workflows/main/badge.svg
620
621[build]: https://github.com/wooorm/refractor/actions
622
623[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/refractor.svg
624
625[coverage]: https://codecov.io/github/wooorm/refractor
626
627[downloads-badge]: https://img.shields.io/npm/dm/refractor.svg
628
629[downloads]: https://www.npmjs.com/package/refractor
630
631[size-badge]: https://img.shields.io/bundlephobia/minzip/refractor.svg
632
633[size]: https://bundlephobia.com/result?p=refractor
634
635[npm]: https://www.npmjs.com/package/refractor/tutorial
636
637[license]: license
638
639[author]: https://wooorm.com
640
641[releases]: https://github.com/wooorm/refractor/releases
642
643[rehype]: https://github.com/rehypejs/rehype
644
645[names]: https://prismjs.com/#languages-list
646
647[themes]: https://prismjs.com/#theme
648
649[react]: https://facebook.github.io/react/
650
651[vdom]: https://github.com/Matt-Esch/virtual-dom
652
653[to-hyperscript]: https://github.com/syntax-tree/hast-to-hyperscript
654
655[to-html]: https://github.com/syntax-tree/hast-util-to-html
656
657[browser]: #browser
658
659[prism]: https://github.com/PrismJS/prism
660
661[prismjs]: https://www.npmjs.com/package/prismjs
662
663[lowlight]: https://github.com/wooorm/lowlight
664
665[hljs]: https://github.com/isagalaev/highlight.js
666
667[browserify]: https://github.com/browserify/browserify
668
669[tinyify]: https://github.com/browserify/tinyify
670
671[node]: https://github.com/syntax-tree/hast#ast
672
673[syntax]: #syntaxes
674
675[register]: #refractorregistersyntax
Note: See TracBrowser for help on using the repository browser.