* Test for duplicate symbols/macros
We've had a few cases where we accidentally include the same symbol or macro
definition in both macros.js and symbols.js. This new test automatically
detects these scenarios during Jest testing.
* Fix lint errors
* Support \textup and \textmd
This PR adds support for `\textup` and `\textmd`, which are the inverses of
`\textit` and `\textbf`. Unlike bare `\text`, they result in `textup` and
`textmd` classes being applied, but those have no CSS rules, so they act the
same as bare `\text`.
Fixes#1909.
* Add documentation
* Add unsupported font commands
Update `test/screenshotter/test.tex`'s definition of `\KaTeX` macro to match
the metrics of `src/macros.js`'s definition of `\KaTeX`, and thereby fix#1703.
I just changed the `\kern` metrics to match the update from #974, and left
the font selection code to match LaTeX's definition of `\LaTeX`.
* Remove double encoding in MathML via Unicode MathML spaces
We used to have a complex mechanic for escaping strings, marking them as
`needsEscape = false`, and then not escaping those strings (for
combining strings in `\operatorname`). But this doesn't really work
with `render`ing directly to a node, as `document.createTextNode` can't
be stopped from escaping.
I've thus removed this mechanic, which required the following changes:
* Switch MathML "smart space" encoding to use Unicode instead of
`&LongNames;` (which weren't working with `render` for the same reason).
* Hack our HTML/MathML serializer to not use `String.trim`, which wrecks
havoc with emitted Unicode spaces.
Now `toText()` doesn't escape, so strings concatenate in unescaped form,
and `toHTML()` only does the necessary escaping. Thus fix#1782.
* Fix src/utils.js
Co-Authored-By: edemaine <edemaine@mit.edu>
* Fix src/mathMLTree.js documentation
Co-Authored-By: edemaine <edemaine@mit.edu>
* Remove trim hack thanks to diffable-html@4.0.0
* Switch back to jest-serializer-html
* Update mathMLTree.js
* Fix \\ and \newline after operator
Fix#1790. `\\` and `\newline` render as a span with classes
`mspace` and `newline`. We need to check for `newline` when bringing
spaces into the same `base` group.
* Add tests and comment
* Remove redundant consumeSpaces()
- Spaces after command sequence are ignored in Lexer
- parseExpression consumes spaces in the math mode
* Add catcode to Lexer, move comment parsing back to Lexer
- Fix parsing a comment before a sup/subscript argument
- Fix parsing a comment before an expression
- Fix parsing a comment before or between \hline
- Fix parsing a comment in the macro definition
- Fix parsing a comment including a command sequence
* Update Lexer.js
* Update Parser.js
* catcode -> catcodes
* Add support for `\lparen` and `\rparen` delimiters.
* Add missing math delimiter. Fix alphabetic order.
* Add test.
* Add spaces between parenthesis and square brackets.
* Move unsupported command (undefined control sequence) error to parseSymbol
* Change parseGivenFunction and parseFunction to parse only function
* Move \begin handling to environment.js
* Remove ParsedFunc/Arg, move logics into parseGroup
* Fix flow error
* Remove parseFunction, rename parseGivenFunction to parseFunction
* Minor fixes
* Remove previously resolved TODO
* Minor fixes
* Update flow typing
* Fix tag positioning to live within katex-html parent
`.tag` has `position: absolute`, but this positions it relative to the nearest
parent with a non-static `position` (see
https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block).
This PR makes `.katex-display > .katex > .katex-html` that parent.
* Update screenshots
* Upgrade to Babel 7
* Update dependencies
* Remove `modules` and `useEsModules` as module support is automatically detected
Target browsers supporting ESM in the ESM build.
* Disable corejs aliasing (polyfill)
* Fix package.json and update lockfile
* Bump CircleCI cache version
* Remove `Object.values()` use for Node 6 compatability
* Remove redundant arguments to @babel/register
* Update rollup and rollup-plugin-babel
* Add ignore option to no-transform-runtime-aliasing
Ignore JSON.stringify, parseInt, and ParseFloat
* Upgrade babel-loader to 8.0.1
* Use api.env() in Babel configuration
* Upgrade babel-loader to 8.0.2
* Update comment for defineFunction handler.
* Rename .value to .text in all token-style ParseNodes.
* Rename symbolNode's .value to .text.
* Rename color-token's .value to .color.
* Fix roots
* Update screenshots
* Added a test in a craven gambit to get a green check mark
* Adjust small radicals
* Fix lint error
* Update screenshots