- {value}
+ {/* For this case, we can specify to highlight the code in runtime instead of compile time */}
+
+ {value}
+
))}
diff --git a/packages/theme-default/src/layout/DocLayout/docComponents/code/index.tsx b/packages/theme-default/src/layout/DocLayout/docComponents/code/index.tsx
index 03d957586..bd1f7000a 100644
--- a/packages/theme-default/src/layout/DocLayout/docComponents/code/index.tsx
+++ b/packages/theme-default/src/layout/DocLayout/docComponents/code/index.tsx
@@ -10,12 +10,15 @@ import { SvgWrapper } from '#theme/components/SvgWrapper';
export interface CodeProps {
children: string;
className?: string;
+ codeHighlighter?: 'prism' | 'shiki';
meta?: string;
}
export function Code(props: CodeProps) {
const { siteData } = usePageData();
- const { defaultWrapCode, codeHighlighter } = siteData.markdown;
+ const codeHighlighter =
+ props.codeHighlighter ?? siteData.markdown.codeHighlighter;
+ const { defaultWrapCode } = siteData.markdown;
const [codeWrap, setCodeWrap] = useState(defaultWrapCode);
const wrapButtonRef = useRef