Add syntax highlighting and light/dark themes to twui CodeBlock
- Highlight string children with refractor (Prism) when `language` is set, rendered as React token spans; add ini/bash/json/yaml/ts support - Add `theme` prop (auto | light | dark); auto follows the `.dark` class. Palettes are `--twui-code-*` CSS variables (GitHub Light/Dark, all tokens WCAG AA) so custom themes need no component changes - Fix layout: real padding, singleBlock copy button no longer covers the code, clipped rounded corners, wrapperProps.style honoured, long tokens wrap - MDX helpers take `codeTheme` and no longer force a black background - Highlight WireGuard config blocks as ini Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
"openai": "^7.4.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"react-markdown": "^10.1.0",
|
||||
"refractor": "^5.0.0",
|
||||
"rehype-prism-plus": "^2.0.2",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"sharp": "^0.35.3",
|
||||
|
||||
Reference in New Issue
Block a user