Bring your own highlighter
Shiki stays the default, and isn't loaded when you highlight code with another highlighter.
fumadocs-core/highlightexports aHighlighterinterface, created withcreateHighlights()fromfumadocs-core/highlight/highlights(@pierre/highlights) orcreateShikiHighlighter()fromfumadocs-core/highlight/shiki,override()creates one with other options.rehypeCodeFromHighlighterfromfumadocs-core/mdx-plugins/rehype-code.corehighlights code blocks with a highlighter, or a function creating one with the transformers of Fumadocs.createRehypeCodeis deprecated, Sätteri hasrehypeCodeFromHighlighterin@fumadocs/satteri/rehype-code. PasstransformerTwoslash()in itstransformersoption to analyze Twoslash blocks in batches.createServerCodeBlock()andcreateDynamicCodeBlock()in Fumadocs UI create code blocks from a highlighter. Dynamic code blocks are highlighted on the server too.toJsx()fromfumadocs-core/utils/hast-to-jsxconverts hast into React elements liketoJsxRuntime()ofhast-util-to-jsx-runtime, MDX nodes through anevaluator, over 10x faster on highlighted code, whose spans render as one HTML string. Every Fumadocs renderer uses it,hast-util-to-jsx-runtimeis no longer a dependency.- Twoslash loads the languages of code blocks in popups before highlighting, an unknown language there no longer fails the code block.
- OpenAPI Standalone highlights code blocks with Highlights, in its server-rendered pages too.
- The page factories of OpenAPI, GraphQL and AsyncAPI, type tables,
createPython(),createPythonComponents(),localHtml()and the shadcncreateSnippet()take ahighlighter. - Deprecated
shikiandshikiOptionsof the API pages andshikiof type tables, pass ahighlighterinstead. - Integrations require
fumadocs-core16.17.8, the API pages and shadcn also requirefumadocs-ui16.17.8.
TypeScript 7.1
Twoslash, type tables and story controls run on the stable API of TypeScript 7.1 (typescript@7.1.0-beta), with code loaded as in-memory files.
- Twoslash no longer writes code blocks to the
.twoslashdirectory, you can remove it from.gitignore. - Twoslash completions work in the global scope, relative paths in compiler options (like
paths) resolve fromcwd. - No
tsconfig.fumadocs-typescript.jsonortsconfig.fumadocs-story.jsonis generated. - Type tables are 2.4x faster on large API references, each from a program of its file and the files it imports.
- The
transformoption of type tables gets the checker of TypeScript 7.1,typeToString()takesTypeFormatFlags.