Twoslash code highlighter breaks when rendering hover that has a js code block in it. · Issue #403 · anza-xyz/kit · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider console.log(). Its docs look like this (notice the code fence inside the docblock):
/** * Prints to `stdout` with newline. Multiple arguments can be passed, with the * first used as the primary message and all additional used as substitution * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). * * ```js * const count = 5; * console.log('count: %d', count); * // Prints: count: 5, to stdout * console.log('count:', count); * // Prints: count: 5, to stdout * ``` * * See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information. * @since v0.1.100 */
When Twoslash goes to render a codeblock with console.log() in it, it tries to recursively render the js code fence inside the docs for console.log(). When it does so, we get this:
./content/docs/upgrade-guide.mdx
Error evaluating Node.js code
ShikiError: upgrade-guide.mdx:ShikiError: Language `js` not found, you may need to load it first
[at Object.getLanguage (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1756:13)]
[at codeToTokensBase (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:809:29)]
[at file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1015:21]
[at <anonymous>]
[at codeToTokensWithThemes (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1014:31)]
[at codeToTokens (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1109:25)]
[at codeToHast (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1168:7)]
[at Object.codeToHast (file:///home/sol/src/kit/docs/node_modules/.pnpm/@shikijs+core@3.3.0/node_modules/@shikijs/core/dist/index.mjs:1155:36)]
[at code (file:///home/sol/src/kit/docs/node_modules/.pnpm/fumadocs-twoslash@3.1.1_@types+react-dom@19.0.4_@types+react@19.0.12__@types+react@19.0_9e9244c803143d69682599df624dac14/node_modules/fumadocs-twoslash/dist/index.js:118:23)]
[at Object.one (file:///home/sol/src/kit/docs/node_modules/.pnpm/mdast-util-to-hast@13.2.0/node_modules/mdast-util-to-hast/lib/state.js:254:14)]
Consider
console.log()
. Its docs look like this (notice the code fence inside the docblock):When Twoslash goes to render a codeblock with
console.log()
in it, it tries to recursively render thejs
code fence inside the docs forconsole.log()
. When it does so, we get this:Related: fuma-nama/fumadocs#1095 (comment)
The text was updated successfully, but these errors were encountered: