Code Blocks
ciderpress uses Rspress's built-in Shiki integration for compile-time syntax highlighting. All features below work in any .md or .mdx file with zero configuration.
Syntax highlighting
Specify a language after the opening fence:
Code
Output
Title
Add a filename or label to any code block:
Code
Output
Line numbers
Toggle per-block with the lineNumbers meta attribute:
Code
Output
Disable with lineNumbers=false if globally enabled.
Line highlighting
Highlight specific lines using curly-brace ranges in the meta:
Code
Output
Or use inline notation comments:
Code
Output
Diff highlighting
Mark added and removed lines with inline notation:
Code
Output
Or use the diff language for classic +/- prefix syntax:
Error and warning lines
Code
Output
Focus
Dim everything except the focused lines:
Code
Output
Code wrapping
Wrap long lines instead of horizontal scrolling:
Code
Output
File embedding
Pull content from a file at build time:
Use <root> to reference the project root:
Combining options
All meta attributes can be combined:
Code
Output
Tabs
Wrap code blocks in switchable tabs using Rspress's built-in components. Requires an .mdx file:
Package manager tabs
Auto-generate install commands for npm, yarn, pnpm, bun, and deno. Requires an .mdx file:
Or provide custom per-manager commands:
TypeScript twoslash
Render inline type tooltips and compiler diagnostics directly in code blocks. The twoslash meta attribute activates the TypeScript Twoslash integration, which runs the TypeScript compiler over your code and injects the results as annotations. This works out of the box with no additional configuration.
The ^? comment triggers a type query, rendering the inferred type (const str: "hello") as an inline tooltip below the variable.