Language grammars listed below are re-distributed via tm-grammars
into the shikiji
package.
Grammars are covered by their repositories’ respective licenses, which are permissive (apache-2.0, mit, etc), and made available in this NOTICE.
For loading your custom languages, please reference to this guide.
You can set lang to text
to bypass highlighting. This is useful as the fallback when you receive user specified language that are not available. For example:
import { codeToHtml } from 'shikiji'
const html = codeToHtml('console.log("Hello World")', {
lang: 'text', // [!code hl]
theme: 'vitesse-light',
})
txt
, plain
are provided as aliases to text
as well.
A special processed language ansi
is provided to highlight terminal outputs. For example:
�[0;90m┌�[0m �[0;36;1mWelcome to VitePress!�[0m�[0m
�[0;90m│�[0m�[0m
�[0;32m◇�[0m Where should VitePress initialize the config?�[0m
�[0;90m│�[0m �[0;2m./docs�[0m�[0m
�[0;90m│�[0m�[0m
�[0;32m◇�[0m Site title:�[0m
�[0;90m│�[0m �[0;2mMy Awesome Project�[0m�[0m
�[0;90m│�[0m�[0m
�[0;32m◇�[0m Site description:�[0m
�[0;90m│�[0m �[0;2mA VitePress Site�[0m�[0m
�[0;90m│�[0m�[0m
�[0;36m◆�[0m Theme:�[0m
�[0;36m│�[0m �[0;32m●�[0m Default Theme �[0;2m(Out of the box, good-looking docs)�[0m�[0m
�[0;36m│�[0m �[0;2m○�[0m �[0;2mDefault Theme + Customization�[0m�[0m
�[0;36m│�[0m �[0;2m○�[0m �[0;2mCustom Theme�[0m�[0m
�[0;36m└�[0m
Check the raw markdown of code snippet above.