There are many syntax highlighting libraries available, such as
Prism.js, highlight.js,
and Shiki. This recipe uses Shiki.
Install Dependencies
Create a Highlighter
Create a utility function that transforms HTML content with syntax highlighting:lib/highlight.ts
Use with the SDK
Apply the highlighter when fetching posts:Configuration
Shiki supports many themes and languages. Update thecreateHighlighter options to match your needs: