Fix the docgen to use prism as a cjs file instead.

main
Zed A. Shaw 1 year ago
parent 9533f4faf7
commit b5c6f92721
  1. 2
      client/components/CodeFormatter.svelte
  2. 10
      lib/docgen.js
  3. 14
      package-lock.json
  4. 1
      package.json
  5. 0
      static/js/prism.cjs

@ -6,4 +6,4 @@
});
</script>
<Source src="/js/prism.js" on:load={ onLoad }/>
<Source src="/js/prism.cjs" on:load={ onLoad }/>

@ -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";
@ -52,15 +51,10 @@ const line_number_spans = (str) => {
* Runs Prism on the string, defaulting to the "markup"
* language which will encode most code correctly even
* if you don't specify a language after the ```
* */
**/
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);

14
package-lock.json generated

@ -51,7 +51,6 @@
"pino-pretty": "^4.7.1",
"playwright": "^1.23.3",
"pm2": "^5.2.0",
"prismjs": "^1.27.0",
"random": "3.0.6",
"randomcolor": "^0.6.2",
"redis": "^3.1.2",
@ -11394,14 +11393,6 @@
"node": ">= 0.8.0"
}
},
"node_modules/prismjs": {
"version": "1.27.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz",
"integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==",
"engines": {
"node": ">=6"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@ -23118,11 +23109,6 @@
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="
},
"prismjs": {
"version": "1.27.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz",
"integrity": "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA=="
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",

@ -111,7 +111,6 @@
"pino-pretty": "^4.7.1",
"playwright": "^1.23.3",
"pm2": "^5.2.0",
"prismjs": "^1.27.0",
"random": "3.0.6",
"randomcolor": "^0.6.2",
"redis": "^3.1.2",

Loading…
Cancel
Save