highlighter

Guide

Loading grammars, the HTML render modes, themes, and consuming tokens directly.

Loading grammars, the HTML render modes, themes, and consuming tokens directly.

Pages

  • Loading Grammars — highlighter reads TextMate grammars — the .tmLanguage.json files that VS Code and TextMate use to describe a language. Any VS Code-compatible grammar works unchanged.
  • HTML Rendering — highlight(code) returns an HTML string with one per highlighted run. How those spans are styled depends on the render mode you pass when building the highlighter. Text is HTML-escaped,…
  • Themes — A Theme maps each of the nine highlight categories to a colour. Themes are used by InlineMode to emit inline style colours, and you can read a theme yourself when…
  • Tokens — When you render to something other than a web page — a PDF, a terminal, a GUI — take the tokens directly instead of producing HTML and parsing it back…

Search

Esc
to navigate to open Esc to close