code-hike / lighter

The syntax highlighter used by Code Hike.
https://lighter-codehike.vercel.app
83 stars 8 forks source link

crashes with Unknown language #39

Open tomByrer opened 6 months ago

tomByrer commented 6 months ago

mmd = MermaidJS, but I get that you don't have a language for that.

Unhandled Runtime Error
Error: Unknown language: mmd

Call Stack
eval
(rsc)/node_modules/@code-hike/lighter/dist/index.esm.mjs (1:729565)
Array.map
<anonymous>
HB
(rsc)/node_modules/@code-hike/lighter/dist/index.esm.mjs (1:729512)
EQ
(rsc)/node_modules/@code-hike/lighter/dist/index.esm.mjs (1:740731)
extractCommentAnnotations
(rsc)/node_modules/codehike/dist/code/extract-annotations.js (51:79)
splitAnnotationsAndCode
(rsc)/node_modules/codehike/dist/code/extract-annotations.js (11:61)
tokenize
(rsc)/node_modules/codehike/dist/code/code-to-tokens.js (6:69)
CodeContent
(rsc)/node_modules/codehike/dist/code/code-content.js (9:33)
eR
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:263006)
<unknown>
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:275808)
Array.toJSON
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:280578)
stringify
<anonymous>
<unknown>
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:266934)
eW
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:267013)
ez
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:267413)
Timeout._onTimeout
/home/person/c/react/mermax-demo/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:263912)
listOnTimeout
node:internal/timers (573:17)
process.processTimers
node:internal/timers (514:7)
pomber commented 6 months ago

Hi, I think that's intended. There's a list LANG_NAMES export, if you need to know the available languages before calling.

But looks like you are using codehike, in that case codehike should show warnings for missing languages (not implemented yet).

For mermaid in particular people usually want to ignore syntax highlighting, which is also not supported yet on codehike.