fluxml.github.io icon indicating copy to clipboard operation
fluxml.github.io copied to clipboard

Inline Latex is not rendering - update highlight, katex, and vela scripts

Open Saransh-cpp opened this issue 2 years ago • 3 comments

The current website does not render inline Latex (see Simulating the Motion of Charged Bodies, Differentiable Control Problems) and throws the following error in the CI -

Error: Cannot find module '/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js'
Require stack:
- /home/runner/work/fluxml.github.io/fluxml.github.io/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at [eval]:1:15
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:78:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/runner/work/fluxml.github.io/fluxml.github.io/[eval]' ]
}

Node.js v18.16.0
┌ Franklin Warning: in <2019-09-11-simulating-the-motion-of-charges.md>
│ Encountered an issue processing '2019-09-11-simulating-the-motion-of-charges.md' in .github.io/blogposts.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ ProcessFailedException(Base.Process[Process(`/home/runner/.julia/artifacts/9c278c61d6242d19deca58e582fc6a6f0a727de8/bin/node -e "const katex = require(\"/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js\");
│ var html = katex.renderToString(\"', right: '\\\", {displayMode: true})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"U = \\frac{1}{4 \\pi \\epsilon_0}\\frac{q_1q_2}{r}\", {displayMode: true})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"U\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"n\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"^nC_2\", {displayMode: false})
│ console.log(html)
│ "`, ProcessExited(1))])
└
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module '/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js'
Require stack:
- /home/runner/work/fluxml.github.io/fluxml.github.io/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at [eval]:1:15
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:78:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/runner/work/fluxml.github.io/fluxml.github.io/[eval]' ]
}

Node.js v18.16.0
┌ Franklin Warning: in <2019-02-07-what-is-differentiable-programming.md>
│ Encountered an issue processing '2019-02-07-what-is-differentiable-programming.md' in .github.io/blogposts.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ ProcessFailedException(Base.Process[Process(`/home/runner/.julia/artifacts/9c278c61d6242d19deca58e582fc6a6f0a727de8/bin/node -e "const katex = require(\"/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js\");
│ var html = katex.renderToString(\"', right: '\\\", {displayMode: true})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"y = σ(W \\times x + b)\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"f(x)\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"f\", {displayMode: false})
│ console.log(html)
│ "`, ProcessExited(1))])
└
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module '/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js'
Require stack:
- /home/runner/work/fluxml.github.io/fluxml.github.io/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at [eval]:1:15
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:78:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/runner/work/fluxml.github.io/fluxml.github.io/[eval]' ]
}

Node.js v18.16.0
┌ Franklin Warning: in <2019-03-05-dp-vs-rl.md>
│ Encountered an issue processing '2019-03-05-dp-vs-rl.md' in .github.io/blogposts.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ ProcessFailedException(Base.Process[Process(`/home/runner/.julia/artifacts/9c278c61d6242d19deca58e582fc6a6f0a727de8/bin/node -e "const katex = require(\"/home/runner/work/fluxml.github.io/fluxml.github.io/_libs/katex/katex.min.js\");
│ var html = katex.renderToString(\"', right: '\\\", {displayMode: true})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"y = f(x)\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"\\frac{dy}{dx}\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"x\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"y\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"x\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"y\", {displayMode: false})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"\n\\begin{aligned}\n  f(x) &=\n    \\begin{cases}\n    1 & x \\ge 0 \\\\\\\n    -1 & x < 0\n    \\end{cases} \\\\\\\n  \\frac{df}{dx} &= 1\n\\end{aligned}\n\", {displayMode: true})
│ console.log(html)
│ 
│ console.log(\"_>fdsplit<_\")
│ var html = katex.renderToString(\"f\", {displayMode: false})
│ console.log(html)
│ "`, ProcessExited(1))])
└

This PR updates the highlight, katex, and vela scripts - taken directly from Franklin.jl's repo.

PR Checklist

  • [ ] Tests are added
  • [ ] Documentation, if applicable

Saransh-cpp avatar Oct 31 '23 10:10 Saransh-cpp

That is a lot of extra files (over 300!) and it's not clear to me why we need most of them. Can we not update our use of Franklin to have those be generated or added automatically instead?

ToucheSir avatar Nov 02 '23 00:11 ToucheSir

Most of those files are CSS for different code block themes? Can we just eliminate all of those files except the theme that we are currently using?

darsnack avatar Nov 19 '23 15:11 darsnack

Thanks for the reviews! Sorry for sitting on this too long. I'll convert this to a draft and look into eliminating files.

Saransh-cpp avatar Nov 21 '23 09:11 Saransh-cpp