File tree Expand file tree Collapse file tree
packages/node-legacy/src/legacy-html/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @node-core/doc-kit-legacy ' : patch
3+ ---
4+
5+ ` legacy-html ` builds about 30% faster: Shiki no longer parses its themes again for every code block.
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import shikiConfig from '@doc-kit/core/shiki.config.mjs';
55import { h as createElement } from 'hastscript' ;
66import { SKIP , visit } from 'unist-util-visit' ;
77
8- const highlighter = await createHighlighter ( ) ;
8+ const [ lightTheme , darkTheme ] = shikiConfig . themes ;
9+
10+ const highlighter = await createHighlighter ( {
11+ themes : { light : lightTheme , dark : darkTheme } ,
12+ } ) ;
913
1014// This is what Remark will use as prefix within a <pre> className
1115// to attribute the current language of the <pre> element
@@ -93,8 +97,9 @@ export default function rehypeShikiji() {
9397 preElement . children [ 0 ] . value ,
9498 {
9599 lang : highlighter . resolveLanguage ( languageId ) ,
96- // Allows support for dual themes (light, dark) for Shiki
97- themes : { light : shikiConfig . themes [ 0 ] , dark : shikiConfig . themes [ 1 ] } ,
100+ // Allows support for dual themes (light, dark) for Shiki. Given by
101+ // name, as Shiki parses a theme object again for every highlight
102+ themes : { light : lightTheme . name , dark : darkTheme . name } ,
98103 }
99104 ) ;
100105
You can’t perform that action at this time.
0 commit comments