* Introduce MacroExpander
The job of the MacroExpander is turning a stream of possibly expandable
tokens, as obtained from the Lexer, into a stream of non-expandable tokens
(in KaTeX, even though they may well be expandable in TeX) which can be
processed by the Parser. The challenge here is that we don't have
mode-specific lexer implementations any more, so we need to do everything on
the token level, including reassembly of sizes and colors.
* Make macros available in development server
Now one can specify macro definitions like \foo=bar as part of the query
string and use these macros in the formula being typeset.
* Add tests for macro expansions
* Handle end of input in special groups
This avoids an infinite loop if input ends prematurely.
* Simplify parseSpecialGroup
The parseSpecialGroup methos now returns a single token spanning the whole
special group, and leaves matching that string against a suitable regular
expression to whoever is calling the method. Suggested by @cbreeden.
* Incorporate review suggestions
Add improvements suggested by Kevin Barabash during review.
* Input range sanity checks
Ensure that both tokens of a token range come from the same lexer,
and that the range has a non-negative length.
* Improved wording of two comments
Summary: The KaTex renderer used to use old Khan Academy colors when displaying colored text. The configuration is now updated to have the new colors.
Test Plan:
- verified that colored text now uses the new colors in a browser
- running commands such as `\blueA{blueA}` will style the text in the blueA color from the configuration
Reviewers: emily, kevinb
Reviewed By: kevinb
Differential Revision: https://phabricator.khanacademy.org/D27963
Summary: We didn't have a rule for ignoring .sh files in the bower.json,
so it got included in the 0.6.0 release. Oops! This adds it to the
ignore file.
Test Plan:
- ???
Auditors: kevinb
Summary:
We prevent any precommit checks so that we don't have to include
a "Test Plan" etc. in the release commit message.
Test Plan:
- ./release.sh 0.6.0 0.7.0
Auditors: emily
Summary: Make the release script that's been floating around in my gists
for a while into a real script.
Test Plan:
- Comment out all the scary bits (the two pushes, and `npm
publish`), and run:
- `./release.sh 0.6.0`
- Checkout the `v0.6.0` tag, see that it successfully modified
package.json and bower.json to version 0.6.0, and built and committed
the rest of the files.
- `git tag -d v0.6.0`
- `./release.sh 0.6.0 0.7.0`
- Checkout master, see that it successfully made a commit bumping
package.json and bower.json to 0.7.0-pre.
Reviewers: @kevinbarabash
Summary: Looks like there was lint, but `make lint` wasn't failing on it
because it would just automatically fix it! This removes the `--fix`
from `eslint` and fixes the lint.
Test Plan:
- `make lint`
Auditors: kevinb
It looks like the `text-align: center` is affecting the text in sub and
superscripts. Fixes#447
Test Plan:
- Visit [this
example](http://localhost:7936/?text=x%5El_%7Bi%5E%7Bl%2B1%7D%2Bi%2C%20j%5E%7Bl%2B1%7D%2Bj%2C%20d%7D)
- Edit the HTML to add `<span class="katex-display">...</span>` around the
`<span class="katex">` node.
- See that the sub and superscripts are left-aligned, not centered
(It looks like we don't have a way to test this in the screenshotter for now)
@kevinb