Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.26.0 ShikiError: Language abnf not found, you may need to load it first #2609

Closed
yoursunny opened this issue Jun 22, 2024 · 1 comment
Closed
Labels
bug Functionality does not match expectation
Milestone

Comments

@yoursunny
Copy link

yoursunny commented Jun 22, 2024

When README.md contains a language not supported by TypeDoc syntax highlighting, v0.25.13 simply logs a warning, while v0.26.0 has turned this into a hard error.

In the use case, TypeDoc cannot highlight the ABNF language (and there isn't a Shiki option for this language), but GitHub can highlight this language.
Therefore, I'd like to keep the abnf tagging in the README file, so that readers browsing on GitHub can see the highlighted syntax.

Search terms

ShikiError highlight language

Expected Behavior

Upon seeing an unsupported language, TypeDoc should log a warning and render this language as plain text.

Actual Behavior

Upon seeing an unsupported language, TypeDoc exits with error:

TypeDoc exiting with unexpected error:
ShikiError: Language `abnf` not found, you may need to load it first
    at Object.getLanguage (file:///home/runner/work/typedoc-repros/typedoc-repros/node_modules/@shikijs/core/dist/index.mjs:5436:19)
    at codeToTokensBase (file:///home/runner/work/typedoc-repros/typedoc-repros/node_modules/@shikijs/core/dist/index.mjs:530:31)
    at file:///home/runner/work/typedoc-repros/typedoc-repros/node_modules/@shikijs/core/dist/index.mjs:674:62
    at Array.map (<anonymous>)
    at codeToTokensWithThemes (file:///home/runner/work/typedoc-repros/typedoc-repros/node_modules/@shikijs/core/dist/index.mjs:674:53)
    at Object.codeToTokensWithThemes (file:///home/runner/work/typedoc-repros/typedoc-repros/node_modules/@shikijs/core/dist/index.mjs:5520:52)
    at DoubleHighlighter.highlight (/home/runner/work/typedoc-repros/typedoc-repros/node_modules/typedoc/dist/lib/utils/highlighter.js:70:41)
    at highlight (/home/runner/work/typedoc-repros/typedoc-repros/node_modules/typedoc/dist/lib/utils/highlighter.js:162:24)
    at Object.highlight (/home/runner/work/typedoc-repros/typedoc-repros/node_modules/typedoc/dist/lib/output/themes/MarkedPlugin.js:259:56)
    at default_rules.fence (/home/runner/work/typedoc-repros/typedoc-repros/node_modules/markdown-it/dist/index.cjs.js:567:27)
error Command failed with exit code 6.

Steps to reproduce the bug

Insert an unsupported language block in README.md and build the project, like this:

```abnf
; taken from RFC5234
name =  elements crlf
```

Code: TypeStrong/typedoc-repros#41
Failing build: https://github.com/TypeStrong/typedoc-repros/actions/runs/9628193855/job/26556161522

Environment

  • Typedoc version: 0.26.0
  • TypeScript version: 5.4.5
  • Node.js version: 20.14.0
  • OS: Ubuntu 22.04
@yoursunny yoursunny added the bug Functionality does not match expectation label Jun 22, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 22, 2024

I just ran into this too when looking at your repo for memory issues, I wrote all the code to do this, and apparently then never called the function that handled missing languages properly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants