* Implements the alignat environment for flexible math spacing
* Renames alignat[*] to alignedat and factors out duplicate code of aligned and alignedat as alignedHandler
* Adds aligned at to screenshotter
* alignedat screenshots
* Implements the alignat environment for flexible math spacing
* Renames alignat[*] to alignedat and factors out duplicate code of aligned and alignedat as alignedHandler
* Adds aligned at to screenshotter
* alignedat screenshots
* fix style nit
* fix lint
* Fix#946
Issue #946 identified a case in which `array.js` ate the final row of a well-written `aligned` environment.
This PR modifies code from PR #479 to fix this problem and to also continue to eat a trailing `\\` submitted to any environment.
* Fix bug and add tests
* Add final newline to test.
Doh!
* Port stretchy to @flow.
* Removed added quotes on object keys.
* Responded to comments.
* Stretchy: Added assertion on expected number of SVG children.
* Support Unicode relations
This is the first in a series of PRs to give KaTeX the ability to recognize Unicode character input. The code in this PR follows the style of PR #410.
All the characters in this PR will produce rel atoms. I’ll submit PRs for other atom types later.
* Fix lint error.
* Correct mapping errors
This commit fixes a brain cramp of mine.
* Change buildCommon.makeVList params to struct for better type-safety.
This is towards #939.
The expected structure of the makeVList params depends on the `positionType`
parameter. To allow this to be strictly-typed using flow, this PR combines the
co-related parameters into a single struct.
* Add type for makeVList param in comments for documentation.
* Simplify get() now that we don't need it to ignorespaces
Continuation of #912
* Remove commented-out code
* Drop get() alias, rename unget() to pushToken(), use it
* Prevent disappearing fraction lines.
Set a CSS min-height that will ensure that fraction lines will display at least one screen pixel.
Addresses issues #824 and #916.
* Change from dppx to dpi
Change the break point spec from 2dppx to 192dpi. They mean the same thing. I'm making the change because IE supports dpi but not dppx.
Fixes several issues with space handling: (fix#910)
1. "Control symbols" (as they're called in the TeXbook), such as `\\`, should
not have spaces eaten after them (only "control words" such as `\foo`).
2. In math mode, spaces should be consumed at the parser level, not the
gullet level. This enables `\\ [x]` to parse differently from `\\[x]`
3. Eat spaces between arguments, so `\frac x y` still works.
(This used to work only because math mode ate all spaces.
The analog in text mode wouldn't have worked.)
Also eat spaces in initial arguments in math mode, and before ^ and _ in atoms.
* Convert nested SVGs to single-level SVGs
This PR evades a Safari bug which causes nested SVGs to zoom improperly. Fixes the remainder of issue #883.
* Add omitted word
* Fix lint errors
* update screenshots
* Pick up review comments
* Clean up variable names
Remove two more redundant variables.
Allow server to be accessed from anywhere, which is useful for
testing. This potentially reveals the source code to the world,
but this should not be a concern for testing open-source software.
* Replace ParseFuncOrArgument with type-safer alternative.
In the process, document consequences of implementation
details that make type-safety difficult to implement.
* Parser: Added assertFuncOrArg to ensure type-safety.
* Responded to comments.
* Made token mandatory for ParsedFuncOrArgOrDollar.
* Initial webpack config. Moving to ES6 modules. Some module cleanup.
* WIP
* WIP
* Removing commented out code.
* Removing old deps.
* Removing the build script (used for testing).
* Working tests.
* Switching to node api over cli.
* Updating per comments. Still need to fix server.js to properly run the selenium tests.
* Cleaning up the config.
* More cleanup.
* Bringing back server.js for selenium tests.
* Bringing back old dependencies.
* Adding back eslint rules for webpack config. Final cleanup for webpack config.
* Pointing to correct pre-existing module versions. Adding some extra logic to server.js to ensure it gets transpiled properly.
* Getting make build to work again. Updating package.json with some shortcut scripts.
* Resolving conflict.
* Reverting back to commonjs modules.
* Removing extra spaces in babelrc
* Add SourceLocation to encapsulate Token/ParseNode debug information.
* Specify concrete Token text type as it captures type mismatches.
* Responded to comments.
* Implement \verb
* Implement @gagern's comments
* \verb: look up characters one at a time.
* Add screenshot test for \verb
* Add error tests for \verb
* Include space symbol in typewriter font, and fix single quotes
This is based on https://github.com/Khan/MathJax-dev/pull/2
which hasn't been accepted yet at the time this commit is made.
* Add \verb* tests
* \verb should use Typewriter-Regular font!
* Switch \verb to use text mode and no-break space.
* Screenshot update with Typewriter-Regular
* \verb test: fix *, add commas to make spaces clear
* Fix spaces and style handling
* Implement @kevinbarabash's comments
* Make error clearly an assertion failure
* verb screenshot for Chrome
* refactor defineEnvironment to also accept HTML and MathML builders, fixes#870
* make argTypes mandatory, remove unused props from EnvProps, use while(true)
* Fix \sqrt zoom in Safari
This PR evades a Safari bug which causes nested SVGs to zoom improperly. `\sqrt` and single-ended arrow SVGs have been modified.
These have been converted from nested SVGs to single level. Their long tails are now sliced off using CSS `overflow: hidden`.
Safari will still improperly zoom any double-ended stretchy arrows and horizontal braces.
* Fix \sqrt{}
Even if the function argument is empty, still render an SVG whose width equals the surd glyph.
* Fix tall \sqrt when scaled
* update screenshots affected by sqrt fixes
* more screenshots after changes to fix sqrt
* Pick up review comments
* Support \colorbox and \\fcolorbox
These are functions from the `color` package. They accept text, not math. They also have padding similar to `\fbox`.
Because of the padding, the code in `buildHTML` is intermixed with the `\fbox` code. I have not (yet) created a new file in the functions folder. This way, the reviewer gets a cleaner diff.
* Fix lint error
* colorbox screenshots
* Pick up review comments
* Make types in defineFunction stricter and prep for porting functions.js to flow.
* Add more explicit types to functions/delimsizing.js.
* Port functions.js to @flow.
* To @flow: fontMetrics, fontMetricsData, Options, Settings, Style
* Don't overuse $Shape, improve type checking for fontMetrics*, make maxSize required in OptionsData and update callers.
* Remove eslintrc globals change, since eslint-plugin-flowtype makes it redundant.
* Remove extra ?s in Options and Settings
* Undo removal of width in fontMetrics and switch to `T | void` for nullable types in Options
* fix typing of FontMetrics
* Improve SVG Performance
This PR introduces three new classes: `svgNode`, `pathNode`, and `lineNode`. SVG data is then loaded into the domTree exclusively via instances of these classes.
`innerHTML` is banished.
* Fix lint errors
* Fix \cancel typo
* Fix sqrt height
* Adjust min-lenght
Adjust some of the extensible arrows to get a min-length that matches glyph length of the long arrows in KaTeX Main font range from Unicode 27F5 to 27FC.
The accent arrows still get min-lengths that match the arrows in the Unicode 2100 range.
* regenerate screenshots after optimizing SVG code
* update DisplayStyle screenshot for Chrome
* update OverUnderset and Smash screenshots for Chrome as well
* Remove escapes from template strings
* Pick up review comments
* Fix lint errors
* Add comments
* Add eslint-plugin-flowtype. Fix#844
Using the recommended settings for plugin.
This involved adding some spaces to some existing union types.
* Upgrade to eslint@4, fix spotted bugs
Switched to indent-legacy to allow e.g. comments to have extra indents.
* To @flow: MacroExpander.
* Explicitly pass context into defineMacro called with a function.
Instead of binding `this` when `defineMacro` is invoked
with a function, we now pass an explicit context as a
parameter to the function. This is a bit more obvious
and is currently more type-safe due to a bug in `@flow`:
https://github.com/facebook/flow/issues/4809
* Per feedback, rename some types, fields, and variables.
Upgrade match-at and flow versions to resolve the match-at flow
errors, allowing us to remove match-at from the .flowconfig ignore
Test plan:
run `jest` and get the following output:
PASS test/unicode-spec.js
PASS test/errors-spec.js
PASS test/mathml-spec.js
PASS test/katex-spec.js (5.104s)
run `flow` and get:
No errors!