Close up of The Starry Night by Vincent van Gogh (1889)with examples of starry-night over it
starry-night
Syntax highlighting, like what GitHub uses to highlight code, but free and open source and JavaScript!
Contents
- What is this?
- When should I use this?
- What is PrettyLights?
- Install
- Use
- API
- Examples
- Syntax tree
- CSS
- Languages
- Types
- Compatibility
- Security
- Related
- Contribute
- License
What is this?
This package is an open source version of GitHub’s closed-source PrettyLights
project (more on that later).
It supports 490 grammars and its extremely high quality.
It uses TextMate grammars which are also used in popular editors (SublimeText,
Atom, VS Code, &c).
They’re heavy but high quality.
When should I use this?
starry-night is a high quality highlighter
(when your readers or authors are programmers, you want this!)
that can support tons of grammars
(from new things like Astro to much more!)
which approaches how GitHub renders code.
It has a WASM dependency, and rather big grammars, which means that
starry-night might be too heavy particularly in browsers, in which case
lowlight or refractor might be more suitable.
This project is similar to the excellent shiki, and it uses the same
underlying dependencies, but starry-night is meant to match GitHub in that it
produces classes and works with the CSS it ships, making it easier to add dark
mode and other themes with CSS compared to inline styles.
Finally, this package produces objects (an AST), which makes it useful when you
want to perform syntax highlighting in a place where serialized HTML wouldn’t
work or wouldn’t work well.
For example, when you want to show code in a CLI by rendering to ANSI sequences,
when you’re using virtual DOM frameworks (such as React or Preact) so that
diffing can be performant, or when you’re working with hast or
rehype.
Bundled, minified, and gzipped, starry-night and the WASM binary are 185 kB.
There are two lists of grammars you can use: common (33 languages, good for
your own site) adds 160 kB and all (490 languages, useful if are making a site
like GitHub) is 1.35 MB.
You can also manually choose which grammars to include (or add to common): a
language is typically between 3 and 5 kB.
As an example, adding Astro to starry-night with the common grammars costs
an additional 1.5 kB.
What is PrettyLights?
PrettyLights is the syntax highlighter that GitHub uses to turn this:
```markdown
# Hello, world!
```
…into this:
<span class="pl-mh"><span class="pl-mh">#</span><span class="pl-mh"> </span>Hello, world!</span>
…which is what starry-night does too (some small differences in markup, but
essentially the same)!
PrettyLights is responsible for taking the flag markdown, looking it up in
languages.yml from github/linguist to figure out that that
means markdown, taking a corresponding grammar (in this case
atom/language-gfm), doing some GPL magic in C, and turning it
into spans with classes.
GitHub is using PrettyLights since December 2014, when it
replaced Pygments.
They wanted to open source it, but were unable due to licensing issues.
Recently (Feb 2019?), GitHub has slowly started to move towards
TreeLights, which is based on TreeSitter, and also closed source.
If TreeLights includes a language (currently: CSS, CodeQL, EJS, Elixir, Go,
HTML, JS, PHP, Python, Ruby, TS), that’ll be used, for everything else
PrettyLights is used.
starry-night does what PrettyLights does, not what TreeLights does.
I’m hopeful that that will be open sourced in the future and we can mimic both.
Install
⚠️ Important:
npmis currently blocking this package from being published. I’m working on getting it published and I may have to rename it.
This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with npm:
npm install @wooorm/starry-night
In Deno with esm.sh:
import {createStarryNight, common} from 'https://esm.sh/@wooorm/starry-night@1'
In browsers with esm.sh:
<script type="module">
  import {createStarryNight, common} from 'https://esm.sh/@wooorm/starry-night@1?bundle'
</script>
To get the CSS in browsers, do (see CSS for more info):
<!-- This supports light and dark mode automatically. -->
<link rel="stylesheet" href="https://esm.sh/@wooorm/starry-night@1/style/both.css">
Use
import {createStarryNight, common} from '@wooorm/starry-night'
const starryNight = await createStarryNight(common)
const scope = starryNight.flagToScope('markdown')
const tree = starryNight.highlight('# hi', scope)
console.log(tree)
Yields:
{
  type: 'root',
  children: [
    {
      type: 'element',
      tagName: 'span',
      properties: {className: ['pl-mh']},
      children: [{type: 'text', value: '# hi'}]
    }
  ]
}
API
This package exports the identifiers createStarryNight, common, and all.
There is no default export.
createStarryNight(grammars)
Create a StarryNight that can highlight things based on the given grammars.
This is async to facilitate async loading and registering, which is currently
only used for WASM.
Parameters
- grammars(- Array<Grammar>) — grammars to support
Returns
Promise that resolves to an instance which highlights based on the bound
grammars (Promise<StarryNight>).
starryNight.highlight(value, scope)
Highlight value (code) as scope (a TextMate scope).
Parameters
- value(- string) — code to highlight
- scope(- string) — registered grammar scope to highlight as (such as- 'source.gfm')
Returns
Node representing highlighted code (Root).
Example
import {createStarryNight} from '@wooorm/starry-night'
import sourceCss from '@wooorm/starry-night/lang/source.css.js'
const starryNight = await createStarryNight([sourceCss])
console.log(starryNight.highlight('em { color: red }', 'source.css'))
Yields:
{
  type: 'root',
  children: [
    {type: 'element', tagName: 'span', properties: [Object], children: [Array]},
    {type: 'text', value: ' { '},
    // …
    {type: 'element', tagName: 'span', properties: [Object], children: [Array]},
    {type: 'text', value: ' }'}
  ]
}
starryNight.flagToScope(flag)
Get the grammar scope (such as source.gfm) associated with a grammar name
(such as markdown or pandoc) or grammar extension (such as .md or .rmd).
Note that grammars can use the same extensions, in which case GitHub chooses the
first.
Notably, .md is registered by a lisp-like language instead of markdown.
?♂️
Parameters
- flag(- string) — grammar name (such as- 'markdown'or- 'pandoc') or grammar extension (such as- '.md'or- '.rmd')
Returns
Grammar scope, such as 'source.gfm' (string?)
Example
import {createStarryNight, common} from '@wooorm/starry-night'
const starryNight = await createStarryNight(common)
console.log(starryNight.flagToScope('pandoc')) // `'source.gfm'`
console.log(starryNight.flagToScope('workbook')) // `'source.gfm'`
console.log(starryNight.flagToScope('.workbook')) // `'source.gfm'`
console.log(starryNight.flagToScope('whatever')) // `undefined`
starryNight.scopes()
List all registered scopes.
Returns
List of grammar scopes, such as 'source.gfm' (Array<string>).
Example
import {createStarryNight, common} from '@wooorm/starry-night'
const starryNight = await createStarryNight(common)
console.log(starryNight.scopes())
Yields:
[
  'source.c',
  'source.c++',
  // …
  'text.xml',
  'text.xml.svg'
]
starryNight.register(grammars)
Add more grammars.
Parameters
- grammars(- Array<Grammar>) — grammars to support
Returns
A promise resolving to nothing (Promise<undefined>).
Example
import {toHtml} from 'hast-util-to-html'
import {createStarryNight} from '@wooorm/starry-night'
import sourceGfm from '@wooorm/starry-night/lang/source.gfm.js'
import sourceCss from '@wooorm/starry-night/lang/source.css.js'
const markdown = '```css\nem { color: red }\n```'
const starryNight = await createStarryNight([sourceGfm])
console.log(toHtml(starryNight.highlight(markdown, 'source.gfm')))
await starryNight.register([sourceCss])
console.log(toHtml(starryNight.highlight(markdown, 'source.gfm')))
Yields:
<span class="pl-c1">```css</span>
em { color: red }
<span class="pl-c1">```</span>
<span class="pl-c1">```css</span>
<span class="pl-ent">em</span> { <span class="pl-c1">color</span>: <span class="pl-c1">red</span> }
<span class="pl-c1">```</span>
Examples
Example: serializing hast as html
hast trees as returned by starry-night can be serialized with
hast-util-to-html:
import {toHtml} from 'hast-util-to-html'
import {starryNight, common} from '@wooorm/starry-night'
const starryNight = await createStarryNight(common)
const tree = starryNight.highlight('"use strict";', 'source.js')
console.log(toHtml(tree))
Yields:
<span class="pl-s"><span class="pl-pds">"</span>use strict<span class="pl-pds">"</span></span>;
Example: turning hast into react nodes
hast trees as returned by starry-night can be turned into React (or Preact,
Vue, &c) with hast-to-hyperscript:
import {createStarryNight, common} from '@wooorm/starry-night'
import {toH} from 'hast-to-hyperscript'
import React from 'react'
const starryNight = await createStarryNight(common)
const tree = starryNight.highlight('"use strict";', 'source.js')
const reactNode = toH(React.createElement, tree)
console.log(reactNode)
Yields:
{
  '$$typeof': Symbol(react.element),
  type: 'div',
  key: 'h-1',
  ref: null,
  props: {children: [[Object], ';']},
  _owner: null,
  _store: {}
}
Example: integrate with unified, remark, and rehype
This example shows how to combine starry-night with unified:
using remark to parse the markdown and transforming it to HTML with
rehype.
If we have a markdown file example.md:
# Hello
…world!
```js
console.log('it works!')
```
…and a plugin rehype-starry-night.js:
/**
 * @typedef {import('hast').Root} Root
 * @typedef {import('hast').ElementContent} ElementContent
 * @typedef {import('@wooorm/starry-night').Grammar} Grammar
 *
 * @typedef Options
 *   Configuration (optional)
 * @property {Array<Grammar>} [grammars]
 *   Grammars to support (defaults: `common`).
 */
import {createStarryNight, common} from '@wooorm/starry-night'
import {visit} from 'unist-util-visit'
import {toString} from 'hast-util-to-string'
/**
 * Plugin to highlight code with `starry-night`.
 *
 * @type {import('unified').Plugin<[Options?], Root>}
 */
export default function rehypeStarryNight(options = {}) {
  const grammars = options.grammars || common
  const starryNightPromise = createStarryNight(grammars)
  const prefix = 'language-'
  return async function (tree) {
    const starryNight = await starryNightPromise
    visit(tree, 'element', function (node, index, parent) {
      if (!parent || index === null || node.tagName !== 'pre') {
        return
      }
      const head = node.children[0]
      if (
        !head ||
        head.type !== 'element' ||
        head.tagName !== 'code' ||
        !head.properties
      ) {
        return
      }
      const classes = head.properties.className
      if (!Array.isArray(classes)) return
      const language = classes.find(
        (d) => typeof d === 'string' && d.startsWith(prefix)
      )
      if (typeof language !== 'string') return
      const scope = starryNight.flagToScope(language.slice(prefix.length))
      // Maybe warn?
      if (!scope) return
      const fragment = starryNight.highlight(toString(head), scope)
      const children = /** @type {Array<ElementContent>} */ (fragment.children)
      parent.children.splice(index, 1, {
        type: 'element',
        tagName: 'div',
        properties: {
          className: [
            'highlight',
            'highlight-' + scope.replace(/^source\./, '').replace(/\./g, '-')
          ]
        },
        children: [{type: 'element', tagName: 'pre', properties: {}, children}]
      })
    })
  }
}
…and finally a module example.js:
import fs from 'node:fs/promises'
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
import rehypeStarryNight from './rehype-starry-night.js'
const file = await unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypeStarryNight)
  .use(rehypeStringify)
  .process(await fs.readFile('example.md'))
console.log(String(file))
Now running node example.js yields:
<h1>Hello</h1>
<p>…world!</p>
<div class="highlight highlight-js"><pre><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">'</span>it works!<span class="pl-pds">'</span></span>)
</pre></div>
Example: integrating with markdown-it
This example shows how to combine starry-night with markdown-it.
If we have a markdown file example.md:
# Hello
…world!
```js
console.log('it works!')
```
…and a module example.js:
import fs from 'node:fs/promises'
import {createStarryNight, common} from '@wooorm/starry-night'
import {toHtml} from 'hast-util-to-html'
import markdownIt from 'markdown-it'
const file = await fs.readFile('example.md')
const starryNight = await createStarryNight(common)
const markdownItInstance = markdownIt({
  highlight(value, lang) {
    const scope = starryNight.flagToScope(lang)
    return toHtml({
      type: 'element',
      tagName: 'pre',
      properties: {
        className: scope
          ? [
              'highlight',
              'highlight-' + scope.replace(/^source\./, '').replace(/\./g, '-')
            ]
          : undefined
      },
      children: scope
        ? starryNight.highlight(value, scope).children
        : [{type: 'text', value}]
    })
  }
})
const html = markdownItInstance.render(String(file))
console.log(html)
Now running node example.js yields:
<h1>Hello</h1>
<p>…world!</p>
<pre class="highlight highlight-js"><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">'</span>it works!<span class="pl-pds">'</span></span>)
</pre>
Syntax tree
The generated hast starts with a root node, that represents the
fragment.
It contains up to three levels of <span> elements, each with a single class.
All these levels can contain text nodes with the actual code.
Interestingly, TextMate grammars work per line, so all line endings are in the
root directly, meaning that creating a gutter to display line numbers can be
generated rather naïvely by only looking through the root node.
CSS
starry-night does not inject CSS for the syntax highlighted code (because
well, starry-night doesn’t have to be turned into HTML and might not run in a
browser!).
If you are in a browser, you can use the packaged themes, or get creative with
CSS!
?
All themes accept CSS variables (custom properties).
With the theme core.css, you have to define your own properties.
All other themes define the colors on :root.
Themes either have a dark or light suffix, or none, in which case they
automatically switch colors based on a @media (prefers-color-scheme: dark).
All themes are tiny (under 1 kB).
The shipped themes are as follows:
| name | Includes light scheme | Includes dark scheme | 
|---|---|---|
| core.css | ||
| light.css | ✅ | |
| dark.css | ✅ | |
| both.css | ✅ | ✅ | 
| colorblind-light.css | ✅ | |
| colorblind-dark.css | ✅ | |
| colorblind.css | ✅ | ✅ | 
| dimmed-dark.css | ✅ | |
| dimmed.css | ✅ | ✅ | 
| high-contrast-light.css | ✅ | |
| high-contrast-dark.css | ✅ | |
| high-contrast.css | ✅ | ✅ | 
| tritanopia-light.css | ✅ | |
| tritanopia-dark.css | ✅ | |
| tritanopia.css | ✅ | ✅ | 
Languages
Checked grammars are included in common.
Everything is available through all.
You can add more grammars as you please.
Each grammar has several associated names and extensions.
See source files for which are known and use flagToScope to turn them into
scopes.
All licenses are permissive and made available in notice.
Changes should go to upstream repos and languages.yml in
github/linguist.
-  source.c— upstream
-  source.c++— upstream
-  source.cs(mit) — upstream
-  source.css(mit) — upstream
-  source.css.less(mit) — upstream
-  source.css.scss(mit) — upstream
-  source.diff
-  source.gfm(mit) — upstream
-  source.go(bsd-3-clause) — upstream
-  source.graphql(mit)
-  source.ini
-  source.java— upstream
-  source.js(mit) — upstream
-  source.json(isc) — upstream
-  source.kotlin(apache-2.0) — upstream
-  source.lua
-  source.makefile— upstream
-  source.objc
-  source.perl— upstream
-  source.python(mit) — upstream
-  source.r
-  source.ruby(mit) — upstream
-  source.rust(mit) — upstream
-  source.shell(mit) — upstream
-  source.sql
-  source.swift— upstream
-  source.ts(mit) — upstream
-  source.vbnet(apache-2.0) — upstream
-  source.yaml(mit) — upstream
-  text.html.basic(mit) — upstream
-  text.html.php
-  text.xml
-  text.xml.svg(isc) — upstream
-  config.xcompose(mit)
-  file.lasso(public domain)
-  go.mod— upstream
-  go.sum— upstream
-  objdump.x86asm(mit)
-  source.2da(isc) — upstream
-  source.4dm(mit)
-  source.abap— upstream
-  source.abapcds(unlicense) — upstream
-  source.abl(mit)
-  source.abnf(isc) — upstream
-  source.actionscript.3(mit) — upstream
-  source.ada
-  source.afm(isc) — upstream
-  source.agc(isc)
-  source.agda(mit) — upstream
-  source.ahk(unlicense) — upstream
-  source.aidl(apache-2.0) — upstream
-  source.al(mit) — upstream
-  source.alloy(apache-2.0) — upstream
-  source.ampl(mit)
-  source.angelscript(unlicense) — upstream
-  source.antlr
-  source.apache-config
-  source.apl(isc) — upstream
-  source.applescript
-  source.asl(mit) — upstream
-  source.asn(mit) — upstream
-  source.aspectj(mit)
-  source.assembly(bsd-3-clause) — upstream
-  source.astro(mit) — upstream
-  source.ats(mit)
-  source.autoit(mit)
-  source.avro(mit) — upstream
-  source.awk(mit)
-  source.ballerina(apache-2.0) — upstream
-  source.basic(apache-2.0) — upstream
-  source.batchfile(mit) — upstream
-  source.bdf(isc) — upstream
-  source.befunge(mit)
-  source.berry(mit) — upstream
-  source.bf(mit) — upstream
-  source.bicep(mit) — upstream
-  source.blitzmax
-  source.boo(mit) — upstream
-  source.boogie(mit) — upstream
-  source.bp(mit) — upstream
-  source.brightscript(mit)
-  source.bsl(mit) — upstream
-  source.bsv(mit)
-  source.c.ec(unlicense) — upstream
-  source.c.nwscript(isc) — upstream
-  source.cabal(mit) — upstream
-  source.cadence(apache-2.0) — upstream
-  source.cairo(mit) — upstream
-  source.capnp
-  source.ceylon(apache-2.0)
-  source.cfscript(mit)
-  source.chapel(apache-2.0) — upstream
-  source.cil(apache-2.0) — upstream
-  source.cirru(mit) — upstream
-  source.clar(mit) — upstream
-  source.clarion(mit) — upstream
-  source.clean(mit)
-  source.click(mit)
-  source.clips(mit)
-  source.clojure(mit) — upstream
-  source.cmake
-  source.cobol(mit) — upstream
-  source.coffee(mit) — upstream
-  source.cool(mit)
-  source.coq(mit)
-  source.crystal(mit)
-  source.csound(mit) — upstream
-  source.csound-document(mit) — upstream
-  source.csound-score(mit) — upstream
-  source.css.mss(mit)
-  source.css.postcss.sugarss(mit)
-  source.cuda-c++(bsd-3-clause) — upstream
-  source.cue(mit) — upstream
-  source.cuesheet(mit) — upstream
-  source.curlrc(isc) — upstream
-  source.curry(mit) — upstream
-  source.cwl(mit)
-  source.cython
-  source.d— upstream
-  source.dart(bsd-3-clause) — upstream
-  source.data-weave(mit) — upstream
-  source.deb-control(mit) — upstream
-  source.denizenscript(mit) — upstream
-  source.desktop
-  source.dircolors(mit)
-  source.dm(mit)
-  source.dockerfile(mit) — upstream
-  source.dot
-  source.dylan
-  source.earthfile(mpl-2.0) — upstream
-  source.ebnf(isc) — upstream
-  source.ecl(apache-2.0) — upstream
-  source.editorconfig(mit)
-  source.eiffel
-  source.elixir(apache-2.0) — upstream
-  source.elm(mit) — upstream
-  source.emacs.lisp(isc) — upstream
-  source.erlang— upstream
-  source.euphoria(mit) — upstream
-  source.factor(bsd-2-clause)
-  source.fan(mit)
-  source.fancy(bsd-3-clause) — upstream
-  source.faust(mit)
-  source.figfont(isc) — upstream
-  source.firestore(mit)
-  source.fish(mit)
-  source.fnl(mit) — upstream
-  source.fontdir(isc) — upstream
-  source.forth
-  source.fortran
-  source.fortran.modern
-  source.fsharp(mit) — upstream
-  source.fstar(apache-2.0) — upstream
-  source.ftl(mit) — upstream
-  source.futhark(isc) — upstream
-  source.gap— upstream
-  source.gcode(mit) — upstream
-  source.gdb(zlib) — upstream
-  source.gdscript(mit) — upstream
-  source.gedcom(apache-2.0) — upstream
-  source.gemfile-lock(mit) — upstream
-  source.generic-db(isc) — upstream
-  source.genero(mit) — upstream
-  source.genero-forms(mit) — upstream
-  source.gerber(isc) — upstream
-  source.gf(mit) — upstream
-  source.gitattributes(isc) — upstream
-  source.gitconfig(isc) — upstream
-  source.gitignore(isc) — upstream
-  source.gleam(apache-2.0) — upstream
-  source.glsl(unlicense) — upstream
-  source.gn(bsd-3-clause) — upstream
-  source.gnuplot(mit)
-  source.golo(mit) — upstream
-  source.gosu.2(apache-2.0) — upstream
-  source.grace(mit)
-  source.groovy
-  source.groovy.gradle(apache-2.0)
-  source.gsc(unlicense) — upstream
-  source.hack(mit) — upstream
-  source.haproxy-config(mit)
-  source.harbour(mit)
-  source.haskell(mit) — upstream
-  source.hc(unlicense)
-  source.hlsl(mit)
-  source.hoon(mit) — upstream
-  source.hql(mit)
-  source.httpspec(mit) — upstream
-  source.hx(mit) — upstream
-  source.hxml(mit) — upstream
-  source.hy(mit) — upstream
-  source.idl(bsd-3-clause) — upstream
-  source.idris(mit) — upstream
-  source.igor(bsd-3-clause) — upstream
-  source.inform7(mit)
-  source.ini.npmrc(isc) — upstream
-  source.inno(mit) — upstream
-  source.inputrc(isc) — upstream
-  source.io
-  source.ioke(mit)
-  source.isabelle.root(bsd-2-clause) — upstream
-  source.isabelle.theory(bsd-2-clause) — upstream
-  source.j(mit) — upstream
-  source.janet(mit) — upstream
-  source.jasmin(mit)
-  source.java-properties— upstream
-  source.jest.snap(mit) — upstream
-  source.jflex(bsd-2-clause)
-  source.jison(mit)
-  source.jisonlex(mit)
-  source.jolie(mit)
-  source.jq(mit) — upstream
-  source.js.objj
-  source.jsoniq(apache-2.0) — upstream
-  source.jsonnet(apache-2.0)
-  source.julia(mit) — upstream
-  source.kakscript(unlicense) — upstream
-  source.keyvalues(isc) — upstream
-  source.kusto(apache-2.0) — upstream
-  source.lark(isc) — upstream
-  source.lean(apache-2.0) — upstream
-  source.lex(isc) — upstream
-  source.ligo(mit) — upstream
-  source.lilypond(mit) — upstream
-  source.lisp
-  source.litcoffee(mit) — upstream
-  source.livescript(mit) — upstream
-  source.llvm(mit)
-  source.logos(mit) — upstream
-  source.logtalk
-  source.loomscript(mit)
-  source.lsl
-  source.ltspice.symbol(isc) — upstream
-  source.m2(mit) — upstream
-  source.m4(isc) — upstream
-  source.m68k(mit)
-  source.mask(mit)
-  source.mathematica(apache-2.0) — upstream
-  source.matlab(bsd-2-clause) — upstream
-  source.maxscript(isc)
-  source.mc(mit)
-  source.mcfunction(mit) — upstream
-  source.mercury(mit)
-  source.meson(apache-2.0) — upstream
-  source.miniyaml(mit)
-  source.mint(mit) — upstream
-  source.ml— upstream
-  source.mligo(mit) — upstream
-  source.mlir(apache-2.0) — upstream
-  source.mo(apache-2.0) — upstream
-  source.modelica(mit) — upstream
-  source.modula-3(bsd-3-clause) — upstream
-  source.modula2(mit) — upstream
-  source.monkey(mit)
-  source.moonscript(mit)
-  source.mql5(mit)
-  source.msl(mit) — upstream
-  source.mupad(mit) — upstream
-  source.nanorc(isc) — upstream
-  source.nasl(mit) — upstream
-  source.ncl(mit)
-  source.ne(unlicense) — upstream
-  source.nemerle
-  source.neon(isc) — upstream
-  source.nesc(mit)
-  source.netlinx(mit)
-  source.netlinx.erb(mit)
-  source.nextflow(mit)
-  source.nginx(mit) — upstream
-  source.nim(mit) — upstream
-  source.ninja(mit)
-  source.nit(wtfpl)
-  source.nix(mit)
-  source.nsis(apache-2.0)
-  source.nu(apache-2.0)
-  source.nut(mit)
-  source.objc++
-  source.objectscript(mit)
-  source.ocaml
-  source.odin(mit) — upstream
-  source.odin-ehr(isc) — upstream
-  source.ooc(bsd-2-clause)
-  source.opa(mit) — upstream
-  source.opal(mit) — upstream
-  source.opentype(isc) — upstream
-  source.ox(mit)
-  source.oz(mit)
-  source.p4(mit)
-  source.pan(mit)
-  source.papyrus.skyrim(mit)
-  source.parrot.pir
-  source.pascal
-  source.pawn(mit)
-  source.pcb.board(isc) — upstream
-  source.pcb.schematic(isc) — upstream
-  source.pcb.sexp(isc) — upstream
-  source.pegjs(isc) — upstream
-  source.pep8(wtfpl)
-  source.php.zephir— upstream
-  source.pic(isc) — upstream
-  source.pig_latin(mit)
-  source.pike(unlicense)
-  source.plist(mit) — upstream
-  source.po
-  source.pogoscript(mit)
-  source.pony(bsd-2-clause) — upstream
-  source.postcss(mit)
-  source.postscript(isc) — upstream
-  source.pov-ray sdl(mit)
-  source.powershell(mit) — upstream
-  source.prisma(apache-2.0) — upstream
-  source.processing
-  source.procfile(bsd-3-clause) — upstream
-  source.prolog(mpl-2.0)
-  source.prolog.eclipse(mpl-2.0)
-  source.promela(mit) — upstream
-  source.proto(mit) — upstream
-  source.puppet(mit) — upstream
-  source.purescript(mit) — upstream
-  source.python.kivy(mit) — upstream
-  source.q(mit) — upstream
-  source.qasm(mit)
-  source.ql(mit) — upstream
-  source.qmake
-  source.qml(mit)
-  source.qsharp(mit) — upstream
-  source.quake(bsd-3-clause)
-  source.racket(mit)
-  source.raku— upstream
-  source.rascal(bsd-2-clause) — upstream
-  source.reason(mit) — upstream
-  source.rebol(mit) — upstream
-  source.record-jar(isc) — upstream
-  source.red(mit) — upstream
-  source.redirects(isc) — upstream
-  source.reg(mit)
-  source.regexp(isc) — upstream
-  source.rego(apache-2.0) — upstream
-  source.religo(mit) — upstream
-  source.renpy(mit) — upstream
-  source.rescript(mit) — upstream
-  source.rexx(mit) — upstream
-  source.ring(mit)
-  source.rpgle(mit) — upstream
-  source.rpm-spec(mit)
-  source.sas(mit) — upstream
-  source.sass(mit) — upstream
-  source.scad(mit) — upstream
-  source.scala— upstream
-  source.scaml(apache-2.0) — upstream
-  source.scheme
-  source.scilab
-  source.sed(isc) — upstream
-  source.sepolicy(apache-2.0) — upstream
-  source.shaderlab(mit)
-  source.shellcheckrc(isc) — upstream
-  source.shen(bsd-3-clause)
-  source.sieve(isc) — upstream
-  source.singularity(mit) — upstream
-  source.slice(bsd-3-clause) — upstream
-  source.smali(mit) — upstream
-  source.smalltalk(mit)
-  source.smpl(isc) — upstream
-  source.smt(unlicense)
-  source.solidity(mit) — upstream
-  source.solution(isc) — upstream
-  source.sourcepawn(mit) — upstream
-  source.sparql(mit) — upstream
-  source.spin(zlib) — upstream
-  source.sqf(apache-2.0) — upstream
-  source.ssh-config(isc) — upstream
-  source.stan(mit) — upstream
-  source.stata(mit) — upstream
-  source.string-template(isc) — upstream
-  source.stylus(mit)
-  source.supercollider(mit) — upstream
-  source.svelte(mit)
-  source.systemverilog(apache-2.0) — upstream
-  source.talon(mit) — upstream
-  source.tcl
-  source.tea(apache-2.0)
-  source.terra(bsd-3-clause)
-  source.terraform(mit) — upstream
-  source.textproto(mit) — upstream
-  source.thrift
-  source.tl(mit)
-  source.tla(mit)
-  source.tm-properties— upstream
-  source.toc(unlicense)
-  source.toml— upstream
-  source.tsql(mit) — upstream
-  source.tsx(mit) — upstream
-  source.turing(isc) — upstream
-  source.turtle(mit) — upstream
-  source.txl(apache-2.0) — upstream
-  source.ur(mit)
-  source.v(mit) — upstream
-  source.vala(mit) — upstream
-  source.varnish.vcl(mit) — upstream
-  source.verilog
-  source.vhdl
-  source.vim-snippet(mit) — upstream
-  source.viml(mit) — upstream
-  source.vtt(mit)
-  source.vyper(mit) — upstream
-  source.wavefront.mtl(isc) — upstream
-  source.wavefront.obj(isc) — upstream
-  source.wdl(bsd-3-clause) — upstream
-  source.webassembly(isc) — upstream
-  source.webidl(mit) — upstream
-  source.wgetrc(isc) — upstream
-  source.win32-messages(isc) — upstream
-  source.witcherscript(mit) — upstream
-  source.wollok(mit)
-  source.wsd(mit) — upstream
-  source.x10(apache-2.0)
-  source.x86(mit) — upstream
-  source.xc
-  source.xojo(apache-2.0) — upstream
-  source.xq(apache-2.0) — upstream
-  source.xtend(mit)
-  source.yacc(isc) — upstream
-  source.yaml.salt(mit) — upstream
-  source.yang(mit)
-  source.yara(mit) — upstream
-  source.yasnippet(isc) — upstream
-  source.zap
-  source.zeek(bsd-3-clause) — upstream
-  source.zenscript(mit) — upstream
-  source.zig(mit) — upstream
-  source.zil
-  text.bibtex— upstream
-  text.browserslist(mit) — upstream
-  text.codeowners(isc) — upstream
-  text.conllu(apache-2.0)
-  text.dfy.dafny(mit) — upstream
-  text.eml.basic(mit) — upstream
-  text.gherkin.feature(mit) — upstream
-  text.haml(mit)
-  text.html.asciidoc(mit) — upstream
-  text.html.asp
-  text.html.cfm(mit)
-  text.html.creole(mit) — upstream
-  text.html.cshtml(mit)
-  text.html.django
-  text.html.ecr(mit)
-  text.html.elixir(apache-2.0) — upstream
-  text.html.erb(mit) — upstream
-  text.html.ftl(mit)
-  text.html.handlebars(mit)
-  text.html.js(mit)
-  text.html.jsp— upstream
-  text.html.liquid(mit) — upstream
-  text.html.mako(mit)
-  text.html.markdown.source.gfm.apib(mit) — upstream
-  text.html.mediawiki
-  text.html.nunjucks(mit)
-  text.html.php.blade(mit)
-  text.html.riot(mit)
-  text.html.slash(mit)
-  text.html.smarty
-  text.html.soy(mit)
-  text.html.twig(bsd-3-clause) — upstream
-  text.html.vue(mit) — upstream
-  text.jade(mit)
-  text.marko(mit) — upstream
-  text.muse(isc) — upstream
-  text.python.console(mit) — upstream
-  text.python.traceback(mit) — upstream
-  text.rdoc(mit)
-  text.restructuredtext(mit)
-  text.robot(apache-2.0) — upstream
-  text.robots-txt(isc) — upstream
-  text.roff(isc) — upstream
-  text.rtf(mit) — upstream
-  text.runoff(isc) — upstream
-  text.sfd(isc) — upstream
-  text.shell-session(mit) — upstream
-  text.slim(mit)
-  text.srt(mit)
-  text.tex.latex— upstream
-  text.tex.latex.haskell(mit) — upstream
-  text.texinfo(isc) — upstream
-  text.vim-help(mit) — upstream
-  text.xml.ant(mit)
-  text.xml.plist(mit) — upstream
-  text.xml.pom
-  text.xml.xsl
-  text.zone_file(mit) — upstream
Types
This package is fully typed with TypeScript.
It exports additional Grammar and Root types that model their respective
interfaces.
Compatibility
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. It also works in Deno and modern browsers.
You can pass your own TextMate grammars, provided that they work with
vscode-textmate, and that they have the added fields
scopeName, names, and extensions (see types for the definitions and the
grammars in lang/ for examples).
Security
This package is safe.
Related
Contribute
Yes please! See How to Contribute to Open Source.
License
The grammars included in this package are covered by their repositories’
respective licenses, which are permissive (apache-2.0, mit, etc), and made
available in notice.
All other files MIT © Titus Wormer
 
            



 
             
             
            