Rich text / foldkit-richtext-code-shiki

What it owns

The mapping from Shiki to the tokenizer contract, and nothing else. The application owns the highlighter: which grammars and theme it loads, and when. The document stays foldkit-richtext's, and drawing stays the renderer's (span[data-decoration=<kind>]).

Shiki's colours are not used. Its TextMate scopes are read into the same syntax-* kinds the JSON grammar names, so one stylesheet colours every language:

syntax-comment  syntax-property  syntax-string  syntax-number  syntax-keyword
syntax-operator syntax-function  syntax-type    syntax-punctuation

A scope matches by whole segments (string and string.quoted, never stringy), and the first kind that matches wins: a JSON key sits inside string and is a property, and a string's quotes are part of the string. Whitespace and plain identifiers are not decorated.

Install

bash
pnpm add foldkit-richtext-code-shiki shiki