|
|
|
@ -3,8 +3,7 @@ import assert from "assert"; |
|
|
|
|
// Node is absolutely stupid. The remarkable project has an esm setting which
|
|
|
|
|
// specifies the dist/esm directory, but it completely ignores it and complains.
|
|
|
|
|
import { linkify } from "remarkable/dist/cjs/linkify.js"; |
|
|
|
|
import Prism from "prismjs"; |
|
|
|
|
import loadLanguages from "prismjs/components/index.js"; |
|
|
|
|
import Prism from "../static/js/prism.cjs"; |
|
|
|
|
import _ from "lodash"; |
|
|
|
|
import slugify from "slugify"; |
|
|
|
|
import fs from "fs"; |
|
|
|
@ -56,11 +55,6 @@ const line_number_spans = (str) => { |
|
|
|
|
const run_prism = (str, lang="markup") => { |
|
|
|
|
assert(lang !== undefined, "Language can't be undefined."); |
|
|
|
|
|
|
|
|
|
if(!Prism.languages[lang]) { |
|
|
|
|
// try to load the language
|
|
|
|
|
loadLanguages([lang]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// do the check again since the language might not exist
|
|
|
|
|
if(Prism.languages[lang]) { |
|
|
|
|
return Prism.highlight(str, Prism.languages[lang], lang); |
|
|
|
|