~fd/staticmath-server

c18c96555d2fca942224ea86912861cded3d6071 — Ersei Saggi a month ago cf90450 main
Switch to Temml
4 files changed, 29 insertions(+), 21 deletions(-)

M index.js
A package-lock.json
M package.json
M yarn.lock
M index.js => index.js +2 -7
@@ 1,5 1,5 @@
const http = require('http')
const katex = require('katex')
const temml = require('temml')
const qs = require('querystring')

const port = process.env.PORT || 3000


@@ 12,14 12,9 @@ const server = http.createServer((req, res) => {
    })
    req.on('end', function () {
      var post = qs.parse(toparse)
      var output = post['output'] || 'htmlAndMathml'
      if (output != 'html' && output != 'mathml' && output != 'htmlAndMathml') {
        output = 'htmlAndMathml'
      }
      var html = katex.renderToString(post['data'] || '', {
      var html = temml.renderToString(post['data'] || '', {
        throwOnError: false,
        displayMode: post['mode'] === 'block',
        output: output,
      })
      res.end(html)
    })

A package-lock.json => package-lock.json +21 -0
@@ 0,0 1,21 @@
{
  "name": "staticmath-server",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "dependencies": {
        "temml": "^0.10.29"
      }
    },
    "node_modules/temml": {
      "version": "0.10.29",
      "resolved": "https://registry.npmjs.org/temml/-/temml-0.10.29.tgz",
      "integrity": "sha512-JOEYGXYrkXofjzqIU7TcyJXz3Jt1xyIZCCc3OIzkcYdMabdFos7XfedWshdaaSCAQKrNXzf0qejIRZ6Q+x4Hmg==",
      "license": "MIT",
      "engines": {
        "node": ">=18.13.0"
      }
    }
  }
}

M package.json => package.json +2 -3
@@ 1,6 1,5 @@
{
  "dependencies": {
    "katex": "^0.16.9"
  },
  "devDependencies": {}
    "temml": "^0.10.29"
  }
}

M yarn.lock => yarn.lock +4 -11
@@ 2,14 2,7 @@
# yarn lockfile v1


commander@^8.3.0:
  version "8.3.0"
  resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
  integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==

katex@^0.16.9:
  version "0.16.10"
  resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.10.tgz#6f81b71ac37ff4ec7556861160f53bc5f058b185"
  integrity sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==
  dependencies:
    commander "^8.3.0"
temml@^0.10.29:
  version "0.10.29"
  resolved "https://registry.npmjs.org/temml/-/temml-0.10.29.tgz"
  integrity sha512-JOEYGXYrkXofjzqIU7TcyJXz3Jt1xyIZCCc3OIzkcYdMabdFos7XfedWshdaaSCAQKrNXzf0qejIRZ6Q+x4Hmg==