Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Saransh-cpp
Copy link
Member

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

@ToucheSir
Copy link
Member

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?

@darsnack
Copy link
Member

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?

@Saransh-cpp
Copy link
Member Author

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 Saransh-cpp marked this pull request as draft November 21, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants