denoland / docland

The documentation generation website for Deno
https://doc.deno.land
MIT License
119 stars 29 forks source link

Allow arbitrary language on code block #209

Open lambdalisue opened 5 months ago

lambdalisue commented 5 months ago

It appears that when an unknown language is specified in code blocks, docland fails to generate documentation with the following error:

[uncaught application error]: Error - Unknown language: `vim` is not registered

request: {
  url: "http://0.0.0.0:8080/https://raw.githubusercontent.com/vim-denops/deno-denops-std/main/argument/mod.t"... 1 more character,
  method: "GET",
  hasBody: false
}
response: { status: 500, type: "html", hasBody: true, writable: true }

    at a (https://esm.sh/v91/fault@2.0.1/denonext/fault.mjs:2:312)
    at Object.u [as highlight] (https://esm.sh/v91/lowlight@2.4.1/denonext/lowlight.mjs:2:2820)
    at syntaxHighlight (file:///Users/alisue/ghq/github.com/denoland/docland/components/common.tsx:148:27)
    at MarkdownBlock (file:///Users/alisue/ghq/github.com/denoland/docland/components/markdown.tsx:101:28)
    at renderFunctionalComponent (https://deno.land/x/nano_jsx@v0.0.33/core.ts:160:18)
    at _render (https://deno.land/x/nano_jsx@v0.0.33/core.ts:134:70)
    at https://deno.land/x/nano_jsx@v0.0.33/core.ts:46:17
    at Array.forEach (<anonymous>)
    at appendChildren (https://deno.land/x/nano_jsx@v0.0.33/core.ts:41:12)
    at h (https://deno.land/x/nano_jsx@v0.0.33/core.ts:286:3)
[error] Error: Unknown language: `vim` is not registered

    at a (https://esm.sh/v91/fault@2.0.1/denonext/fault.mjs:2:312)
    at Object.u [as highlight] (https://esm.sh/v91/lowlight@2.4.1/denonext/lowlight.mjs:2:2820)
    at syntaxHighlight (file:///Users/alisue/ghq/github.com/denoland/docland/components/common.tsx:148:27)
    at MarkdownBlock (file:///Users/alisue/ghq/github.com/denoland/docland/components/markdown.tsx:101:28)
    at renderFunctionalComponent (https://deno.land/x/nano_jsx@v0.0.33/core.ts:160:18)
    at _render (https://deno.land/x/nano_jsx@v0.0.33/core.ts:134:70)
    at https://deno.land/x/nano_jsx@v0.0.33/core.ts:46:17
    at Array.forEach (<anonymous>)
    at appendChildren (https://deno.land/x/nano_jsx@v0.0.33/core.ts:41:12)
    at h (https://deno.land/x/nano_jsx@v0.0.33/core.ts:286:3)

I believe docland should allow arbitrary languages in code blocks.


[!NOTE]

This causes a "The documentation for this module is currently unavailable." message on the module documentation of deno.land like

CleanShot 2024-02-04 at 15 29 59

It seems this error affects the parent module as well, even though the parent is fine. This is a bit painful for users, as they may feel that the documentation is not ready yet...

CleanShot 2024-02-04 at 15 31 14