diff options
Diffstat (limited to 'nuldoc-src/docbook/to_html.ts')
| -rw-r--r-- | nuldoc-src/docbook/to_html.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/nuldoc-src/docbook/to_html.ts b/nuldoc-src/docbook/to_html.ts index 7c21036..c824780 100644 --- a/nuldoc-src/docbook/to_html.ts +++ b/nuldoc-src/docbook/to_html.ts @@ -1,4 +1,5 @@ -import hljs from "hljs/highlight.min.js"; +// @deno-types="../types/highlight-js.d.ts" +import hljs from "npm:highlight.js"; import { Document } from "./document.ts"; import { DocBookError } from "../errors.ts"; import { @@ -299,13 +300,8 @@ function highlightPrograms(doc: Document) { } const sourceCode = (codeElement.children[0] as Text).content; - const validLanguage = - (hljs as { getLanguage: (s: string) => string }).getLanguage(language) - ? language - : "plaintext"; - const highlighted = (hljs as { - highlight: (s: string, o: { language: string }) => { value: string }; - }).highlight(sourceCode, { language: validLanguage }).value; + const highlighted = + hljs.highlight(sourceCode, { language: language }).value; (codeElement.children[0] as Text).content = highlighted; codeElement.attributes.set("class", "highlight"); |
