Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/channeladam/dev-mathjax-server-docker
A MathJax server docker container to convert inline LaTeX to SVG, MathML or HTML.
https://github.com/channeladam/dev-mathjax-server-docker
docker mathjax mathjax-node mathjax-server
Last synced: 7 days ago
JSON representation
A MathJax server docker container to convert inline LaTeX to SVG, MathML or HTML.
- Host: GitHub
- URL: https://github.com/channeladam/dev-mathjax-server-docker
- Owner: channeladam
- License: apache-2.0
- Created: 2019-08-06T03:45:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T21:40:55.000Z (about 2 years ago)
- Last Synced: 2023-08-06T20:02:57.417Z (over 1 year ago)
- Topics: docker, mathjax, mathjax-node, mathjax-server
- Language: JavaScript
- Homepage:
- Size: 222 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
A MathJax server docker container to convert inline LaTeX to SVG, MathML or HTML.Intended only for running locally on a development or build server - through perhaps as a Hugo shortcode...
# Example Usage
After starting the docker container:
```bash
$ curl "http://localhost:3000/?format=inline-TeX&svg=1&speakText=1&math=\mu"
```Example result:
```javascript
{
"svg":"\nmu\n\n\n\n\n \n\n",
"width":"1.346ex",
"height":"1.843ex",
"style":"vertical-align: -0.671ex;",
"speakText":"\\mu",
"speech":"mu"}
```# Input
Perform an HTTP GET with the options below as query string parameters.
The options documented by [MathJax-node](https://github.com/mathjax/MathJax-node)
```javascript
ex: 6, // ex-size in pixels
width: 100, // width of container (in ex) for linebreaking and tags
useFontCache: true, // use and in svg output?
useGlobalCache: false, // use common for all equations?
linebreaks: false, // automatic linebreaking
equationNumbers: "none", // automatic equation numbering ("none", "AMS" or "all")
cjkCharWidth: 13, // width of CJK charactermath: "", // the math string to typeset
format: "TeX", // the input format (TeX, inline-TeX, AsciiMath, or MathML)
xmlns: "mml", // the namespace to use for MathMLhtml: false, // generate HTML output
htmlNode: false, // generate HTML output as jsdom node
css: false, // generate CSS for HTML output
mml: false, // generate MathML output
mmlNode: false, // generate MathML output as jsdom node
svg: false, // generate SVG output
svgNode: false, // generate SVG output as jsdom nodespeakText: true, // add textual alternative (for TeX/asciimath the input string, for MathML a dummy string)
state: {}, // an object to store information from multiple calls (e.g., if useGlobalCache, counter for equation numbering if equationNumbers ar )
timeout: 10 * 1000, // 10 second timeout before restarting MathJax
```In addition, [mathjax-node-sre](https://github.com/pkra/mathjax-node-sre) accepts:
```javascript
speakText: false, // adds spoken annotations to output
speakRuleset: "mathspeak", // set speech ruleset; default (= chromevox rules) or mathspeak
speakStyle: "default", // set speech style for mathspeak rules: default, brief, sbrief)
semantic: false, // adds semantic tree information to output
minSTree: false, // if true the semantic tree is minified
enrich: false // replace the math input with MathML resulting from SRE enrichment
speech: 'deep' // sets depth of speech; 'shallow' or 'deep'
```# Output
The result object will contain (at most) the following structure:
```javascript
mml: // a string of MathML markup if requested
mmlNode: // a jsdom node of MathML markup if requested
html: // a string of HTML markup if requested
htmlNode: // a jsdom node of HTML markup if requested
css: // a string of CSS if HTML was requested
svg: // a string of SVG markup if requested
svgNode: // a jsdom node of SVG markup if requested
style: // a string of CSS inline style if SVG requested
height: // a string containing the height of the SVG output if SVG was requested
width: // a string containing the width of the SVG output if SVG was requestedspeakText: // a string of speech text if requested (the math that was converted)
speech: // a string of the speakText converted into English - suitable for alt textstate: { // the state object (if useGlobalCache or equationNumbers is set)
glyphs: // a collection of glyph data
defs : // a string containing SVG def elements
AMS: {
startNumber: // the current starting equation number
labels: // the set of labels
IDs: // IDs used in previous equations
}
}
```This is a composition from:
- [MathJax-node](https://github.com/mathjax/MathJax-node#promiseresolveresultoptions--promiserejecterrors--callbackresult-options); and
- [mathjax-node-sre](https://github.com/pkra/mathjax-node-sre/blob/master/lib/main.js)