Register syntax-highlighting languages used in docs code blocks#1046
Open
ntotten wants to merge 1 commit into
Open
Register syntax-highlighting languages used in docs code blocks#1046ntotten wants to merge 1 commit into
ntotten wants to merge 1 commit into
Conversation
Code blocks tagged with languages like csharp, rust, php, swift, kotlin, ruby, c/cpp, scala, dart, elixir, and others were logging "Language X is not loaded for syntax highlighting" and falling back to plain text. Set `syntaxHighlighting.languages` to register them. Because providing this list replaces Zudoku's default set, the defaults are re-listed alongside the additional languages used across the docs (gathered by scanning every code fence in docs/). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rendering docs pages logged a stream of warnings and fell back to plain text for many code blocks:
Zudoku only loads a small default set of languages for Shiki. Anything outside it (the SDK/code-sample languages used across the docs) wasn't highlighted.
Fix
Set
syntaxHighlighting.languagesinzudoku.config.tsx.const languages = config.syntaxHighlighting?.languages ?? defaultLanguages), so the defaults (shellscript,javascript,typescript,json,yaml,python,java,go, etc.) are re-listed alongside the additions to avoid regressing currently-working highlighting.The added languages were gathered by scanning every code fence in
docs/, so this covers more than just the warnings reported (e.g.http,toml,sql,luaare used in the docs and would warn too).ansiandvelocityare used but aren't loadable Shiki grammars, so they're intentionally left as plain text.Verification
Rendered the Zudoku syntax-highlight demo page (which exercises all these languages) in the local dev server:
csharp50 token spans,rust47,cpp68,zig75,swift40,kotlin50,php37,ruby29,scala63,dart75,elixir64,ocaml56,lisp42,objc50,powershell63) — none falling back to plain text.typecheck,prettier --check,guides:check, andlint:admonitionsall pass.🤖 Generated with Claude Code