* Bump flow version
* Bump jest version
* Bump eslint version
* Bump rollup version
* Bump webpack version
* Bump misc dependencies and update lockfile
* Update lockfile
* Bump commander version
* Bump misc dependencies
* Bump istanbul version
* Bump docusaurus version
* Update lockfile
* Explicitly declare dependencies
* Bump caniuse-lite version
* Update lockfile
* Bump commander version
* Bump webpack and css-loader version
* Bump flow version
* Reorganize some glyphs
* Remove mathdefault
Numerals are textord and it was never reachable.
* Use PUA for \imath and \jmath
* Update katex-fonts
* Update tests
* Update src/buildCommon.js
* Update screenshots
* Add comment regarding usage of PUA in \imath and \jmath
* Update fonts
Co-authored-by: Erik Demaine <edemaine@mit.edu>
* Reset to leftmost spacing mode after newline
Newlines have class "mspace newline" but shouldn't be fully ignored:
they should reset the spacing mode back to "leftmost" so as to not
accidentally create trailing spaces at end of lines. Fix#1828.
* Update snapshots
* Add root detection, and treat newline specially only then
Co-authored-by: ylemkimon <mail@ylem.kim>
* Add support for \expandafter
* Add support for \noexpand
* Add support for \edef
* Update comments
* Allow \long before macro definition
* Update documentation
* Update comments
* Fix defPrefix
* Add support for \let
* Update documentation
* Print error token
* Update documentation
* Check whether command is expandable
* Add tests
* Fix token order
* Make noexpand a Token property
* Throw error if control sequence is undefined when expanding
* Rename expandableOnly to expandOnly
* Make unexpandable macro property
* Move \expandafter to macros.js
* Add TODO
* Fix merge conflict
* Update a test case
* Remove unused functions in MacroContextInterface
* Update comments
* Refactor code
* Move \noexpand to macros
* Update MacroExpander.js
* Add a test case
* Separate control sequence check to a function
* Add support for \futurelet
* Separate RHS getter to a function
* Update documentation
* Move expandOnly logic to expandOnce
* Refactor code and update comments
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
* Re-enable \includegraphics now that we have trust setting
This reverts commit 5806b240b3.
* Include Khan Academy test logo in repo and use in test (fix#1892)
* Update screenshots
* Update documentation
* Add tests, cleanup existing tests
* Update snapshots
* Enable trust testing (trust=true by default)
* trust option to indicate whether input text is trusted
* Revamp into trust contexts beyond just command
* Document new trust function style
* Fix screenshot testing
* Use trust setting in \url and \href
* Check `isTrusted` in `\url` and `\href` (so now disabled by default)
* Automatically compute `protocol` from `url` in `isTrusted`, so it
doesn't need to be passed into every context.
* Document untrusted features in support list/table
* Existing tests trust by default
* remove allowedProtocols and fix flow errors
* remove 'allowedProtocols' from documentation
* add a comment about a flow error, rename urlToProtocol to protocolFromUrl
* add tests test that use function version of trust option
* default trust to false in MathML tests
* fix test title, remove 'trust: false' from test settings since it's the default
* 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
* 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.
* 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
* 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`
* Automatic mrel/mbin spacing for \boldsymbol
Fix#1154
* Add test
* Add missing mode
* Separate out \boldsymbol support to correct flow types
* Fix ternaries thanks to @ronkok's comment
* Revert package-lock.json
* Add screenshot test
* Add and expose addFontMetrics function
* fix typo
* recreate package.json-lock
* Add setFontMetrics function to change the defualt metricMap - change getFontMetrics to getGlobalMetrics
* use new setFontMetrics on main KaTeX object
* fix package-lock.json error by rebuilding it
* Add appropriate tests
* update the snapshot
* Support \hdashline
Support `\hdashline` from package `arydshln`. This PR acts as a complement to PR #1395.
Similarly to #1395, the dashed line is rendered as `border-bottom-style: dashed;`. That does not exactly match the `dashsegment` and `dashgap` lengths in `arydshln`, but it does render black lines with sharp edges.
* Fixed top line position
* Add screenshots
* Fix lint error
* Fix another lint error
* Deleted HLine screenshots
* Pick up comments
* Support \arraystretch as a macro definition
Also add `expandMacro` and `expandMacroAsText` helpers to `MacroExpander`.
* Remove excess defaulting
* Add test
* Move test helpers into common modules
* helpers.js gets all the helper functions
* setup.js gets the common Jest setup (serializer, expect extensions)
* Exclude test from coverage testing
* @ylemkimon's comments: parsing -> building, settings || defaultSettings
* Default argument for settings
* Fix lint errors
* @ylemklemon's comment: use buildAndSetResult
* Use template literals
* Stop throwing ParseError when throwOnError is false
`render`, `renderToString`, etc. now catch ParseError and render it to the
raw LaTeX (with proper escaping) and a hover title with the error.
Along the way:
* Use new `katex.__renderToDomTree` in katex-spec's `_getBuilt`.
(This was necessary to get the new error handling in `_getBuilt`.)
* Fix jest results which must always be functions, not strings.
* fix lint
* Fix flow error
Leave error type unspecified, as we check it with instanceof.
* Update katex-spec.js