Shiki-specific markdown options now live in a single `shiki` option whose
fields follow shiki's own naming where they map directly. `ShikiOptions`
and `ThemeOptions` are defined in and exported from the highlight plugin,
like the other markdown plugin option types.
Also hardens the highlighting pipeline while moving it:
- `theme`/`defaultLang`/`transformers` resolve with `??`, so plain-JS
configs passing `null` still get the defaults
- the unknown-language fallback now loads `defaultLang` through the same
guarded path and degrades to `txt` if the configured default itself
cannot load
- `defaultLang` is typed `StringLiteralUnion<BuiltinLanguage |
SpecialLanguage>` for autocompletion, matching how shiki types `lang`
BREAKING CHANGE: the top-level shiki-related markdown options were
removed in favor of `markdown.shiki.*`:
- `markdown.theme` -> `markdown.shiki.theme`
- `markdown.languages` -> `markdown.shiki.langs`
- `markdown.languageAlias` -> `markdown.shiki.langAlias`
- `markdown.defaultHighlightLang` -> `markdown.shiki.defaultLang`
- `markdown.codeTransformers` -> `markdown.shiki.transformers`
- `markdown.colorReplacements` -> `markdown.shiki.colorReplacements`
- `markdown.shikiSetup` -> `markdown.shiki.setup`
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A [list of valid languages](https://shiki.style/languages) is available on Shiki's repository.
A [list of valid languages](https://shiki.style/languages) is available in Shiki's documentation.
You may also customize syntax highlight theme, configure language aliases, and set custom language labels in app config. Please see [`markdown` options](../reference/site-config#markdown) for more details.
Highlighting is configured through the `markdown.shiki` option in app config: pass a custom [theme](https://shiki.style/themes), preload or register [languages](https://shiki.style/guide/load-lang), define [language aliases](https://shiki.style/guide/load-lang#custom-language-aliases), or apply [transformers](https://shiki.style/guide/transformers). Options that map directly to Shiki (`langs`, `langAlias`, `transformers`, `colorReplacements`) use Shiki's own names and types. Custom language labels shown in code blocks are configured separately with `markdown.languageLabel`. See [`markdown` options](../reference/site-config#markdown) for more details.
Check the [type declaration and jsdocs](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts) for all the options available.
Check the [type declaration and jsdocs](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts) for all the options available.
Syntax highlighting options are grouped under `markdown.shiki`. The ones that map directly to Shiki (`langs`, `langAlias`, `transformers`, `colorReplacements`) use [Shiki](https://shiki.style)'s own option names and types — check the [`ShikiOptions` jsdocs](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/plugins/highlight.ts) for the full list:
Set `markdown.headers` to `true` or pass [`@mdit-vue/plugin-headers`](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers) options to collect headings into [`useData().page.headers`](./runtime-api#usedata). This option is disabled by default.
Set `markdown.headers` to `true` or pass [`@mdit-vue/plugin-headers`](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers) options to collect headings into [`useData().page.headers`](./runtime-api#usedata). This option is disabled by default.