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
* Comments without terminating newlines in nonstrict mode
Fix#1506 by allowing single-line comments (`%` without terminating newline)
in nonstrict mode. `Lexer` and `MacroExpander` now store the `Settings`
object, so the `Lexer` can complain about missing newline according to the
`strict` setting. I filtered this out from the snapshot tests with a slightly
different `replacer`.
* Reimplement \href like \verb, add \url
Major restructuring to lex URL arguments differently, e.g. to support
`\href%{hello}` and `\href{http://foo.com/#test%}{hello}`. The new URL
parsing code is simpler, but involves a special case in `parseSymbol`
like `\verb`.
Also add support for `\url` while we're here.
* Cleanup
* Fix flow errors and improve error messages
* Add \url to documentation
* Improve doc formatting
* Switch from nomnom to commander
* Fix#1489
* --macro repeatable option replaced with single --macros option with ";"
separator (until https://github.com/tj/commander.js/issues/674)
* Add missing --max-expand option
* Replace expired --unicode-text-in-math-mode option with --strict
(https://github.com/Khan/KaTeX/issues/1483#issuecomment-405108291)
* Add instructions for how to run in the opening comments
* Clean up option doc strings
* Implement @ylemkimon's comments
* Fix try/const bug
* Fix use of --selenium-ip
It was a quirk that --seleniumIP worked. --help lists --selenium-ip.
* Implement comments, restore --macro repeatable argument
* Cleanup
* Restore 0 default for maxExpand
* Fix more comments from @ylemkimon
* npm run dist -> npm run build
In preparation for #1500
* Fix line length error
* Fix \not vertical alignment
Fix#1491 by changing from `position: absolute` to `position: relative`.
* Switch to \rlap implementation of \not
* Separate \not the macro from \not the symbol via \@not
* Fix test
* Support \pmb
* Fix lint error
* Add phony screenshots
* Screenshots take two
* Screenshots take three
* Simplify copies
* Move determination of mclass from handler to htmlBuilder
* Change to a macro definition
* Update screenshots
* Pick up review comments
* Clean up nesting of braces
* Update screenshot
* Refactor test helpers
* Combine common codes from `parse` and `build`, and dispatch using
`Mode`
* Remove `toNotBuild` and `toNotParse` and use `expect.not`
* Remove `Warning` and instead mock `console.warn`
* Add `expect.toHavePassed` and check whether parse/build succeeded
lazily
* Improve failed test `message`:
- Use color
- Print stack traces(excluding internals)
- Print diff
- Follow jest matcher output style
* Update helpers.js
* Remove toBeTruthy checks
getParsed throws an error if parsing fails.
* Used tagged literals
* Use .toHaveLength
* Use tagged literals
* Use to{Build,Parse}Like where possible
* Remove compareParseTree
* Use snapshot where possible
* Join into one line where <88 chars
* Revert console.warn() to throw an error
Merge `expectToWarn` to `expectKaTeX`, like
`expect.toFailWithParseError`
* Remove call to console.warn from stack traces
* Fix merge errors
* Remove `getTree`
* Move `_getBuilt` into `getBuilt`
* Move default settings and tagging literal support in to `getParsed`
and `getBuilt`
* Remove stack traces clean-up
* Remove `toHavePassed` matcher
* Extract `expected` string construction into `printExpectedResult`
* \@binrel command and refactor
New `\@binrel{x}{y}` command renders `y` as if it's a bin/rel/ord like `x`.
This is equivalent to AMSTeX's `\binrel@{x}\binrel@@{y}`.
It will hopefully be useful for macros, such as `\pmb` (#1418).
Also refactor the (already duplicated) code for implementing this
functionality into buildCommon.binrelClass.
* Add tests; fix flow error
* Another test
* Move binrelClass to functions/mclass.js
* Remove expensive array destructuring polyfill
* \html@mathml
Fix#1452
* Add missing file
* Implement \char (via internal \@char)
* Remove excess <mstyle> wrapper on \mathbin etc.
* Fix tests
* Add Unicode support for \copyright and \textregistered
Testing that this doesn't lead to an infinite loop thanks to \char` escaping.
* Add tests
* Use assertNodeType
* Switch from regex to lookup table, and no parseInt