Commit Graph

800 Commits

Author SHA1 Message Date
Ron Kok
b148d5da71 Support Unicode ° (#1203)
Oddly, `unicode-math-table.txt` does not contain an entry for U+00B0. But `\degree` is surely the correct mapping.
2018-03-10 13:19:13 -05:00
Erik Demaine
abfb641d7a Fix \nobreakspace, refactor "regular space" checking (#1200)
* Fix \nobreakspace, refactor "regular space" checking

Fix #1199 by adding \nobreakspace to the list of commands/symbols that
behave like a regular space character.  Refactor to put that list in one
place, and use an object so it checks instantly instead of sequentially.

* Copy test from #1201
2018-03-10 00:14:42 +01:00
Ryan Randall
017eb7b91d Implementing analyze script (#1197) 2018-03-09 17:13:02 +01:00
Erik Demaine
20b5a58451 Work around negative space bug in Chrome (#1194)
* Work around negative space bug in Chrome

Fix #984

The screenshot test is still somewhat defective, showing a space before
the "post" text (a period).  This seems limited to the screenshotter, however,
as it works fine in the tester via
http://localhost:7936/?text=%5Cfbox%7B%5C%241%2C%5C!000%2C%5C!000%7D%5CKaTeX&display=0&after=.

* Update screenshots

* Switch to inherited `width: min-content`
2018-03-09 16:38:25 +01:00
ylemkimon
06e0393abc Online screenshot diff/generation using CircleCI (#1187)
* Add CircleCI config for online screenshot verification/generation

* Remove `Checkout unicode fonts` step

Unicode-fonts are now a submodule, which is checked out in `Checkout submodule` step.

* Always generate new screenshots
2018-03-06 00:47:41 -05:00
Ashish Myles
0ce53e7631 Port spacingData and unicodeSymbols to @flow. (#1195)
* Port spacingData and unicodeSymbols to @flow.

* Review fixes.

* Made Measurement an exact object type.
2018-03-05 23:43:01 -05:00
ylemkimon
96ad6e0f4f Add unicode-fonts as submodule (#1182)
* Add unicode-fonts as submodule

Removed checkout process from screenshotter.sh.

* Rename test-fonts submodule and update repo URL
2018-03-05 23:29:19 -05:00
Ashish Myles
9e22012619 Port delimiter.js to @flow. (#1177)
* Port delimiter.js to @flow.

* Responded to comments.
2018-03-01 19:57:10 -08:00
Ron Kok
56cfc7cf86 Fix contenteditable mode (#1179)
`makeVList` sets depth with an empty span for which it defines a height. But Chrome, in contenteditable mode only, treats that span as if it contains some text.  The resulting `min-height` can over ride our desired depth.

So we insert an empty span inside the `depthStrut` span.
2018-02-27 13:06:58 -05:00
Erik Demaine
aed1c1e564 unicodeTextInMathMode setting (#1117)
* unicodeTextInMathMode setting

* When `unicodeTextInMathMode` is `true`, accented letters from
  `unicodeSymbols.js`, and CJK and other supported languages,
  get added support in math mode (as requested in #895).
* When `unicodeTextInMathMode` is `false, all of these stop working in
  math mode, and are only supported in text mode (matching XeTeX behavior).
  Note that this is a backwards incompatibility with some 0.9.0 alpha/betas.

* Fix handling of Unicode characters ð, Å, å

* Fix double handling of ð (math maps to \eth, not special Unicode character)
* Remove Åå special math handling, thanks to #1125

* Forbid extraLatin when unicodeTextInMathMode is false
2018-02-19 21:25:20 -05:00
Ryan Randall
7de91f73eb Nested Math in Non-Default Text Fix (#1111)
* Fixing nested math in non-default text. Added appropriate screenshot tests.

* Adding appropriate logic for buildMathML and resolving tests.

* Addressing Kevin's comment. Adding tests.

* Adding appropriate screenshots.

* Removing unnecessary data, adding consistent naming convention.

* Cleanup

* Handling possible edge cases.

* Updating per PR comments
2018-02-19 17:37:08 -05:00
Erik Demaine
b341034d2b Add tests for __* internal interface (#1170)
Inspired by codecov
2018-02-19 10:39:16 -05:00
Kevin Barabash
298b482c18 Bump master to v0.10.0-pre 2018-02-18 16:55:16 -05:00
Erik Demaine
0854bb9f15 Add a paragraph about injection safety (#1161)
* Add a paragraph about injection safety

* Rewrite into Security and Handling errors

* minor edits to the suggested whitelist
2018-02-17 14:48:33 -05:00
Kevin Barabash
789aabe7a1 add .codecov.yml and disable patch coverage (#1164) 2018-02-17 14:11:06 -05:00
Ron Kok
95ffb4fad4 Padding over \sqrt and Paths for frac-line (#1143)
* Padding over \sqrt and Paths for frac-line

This replaces two earlier PRs.

* Restore reaction arrows

* regenerate screenshots

* Set line padding in a constant

* Update with latest master

* Fix lint error

* update screenshots
2018-02-17 13:56:13 -05:00
Erik Demaine
bceb7bd163 Fix handling of Unicode characters ð, Å, å (#1157)
* Fix double handling of ð (math maps to \eth, not special Unicode character)
* Remove Åå special math handling, thanks to #1125
2018-02-13 23:27:02 -05:00
Erik Demaine
627fc11f1b Support \underline in text mode (#1159)
* Support \underline in text mode

Fix #1158

* Add to LowerAccent test
2018-02-13 20:30:30 -05:00
ylemkimon
439cea3e6e Improve JS spacing (#1103)
* Remove dummy spans for spacing around \href

Spacing around \href is handled in the `buildHTML`

* Make bin cancellation aware of children of fragment and anchor

+ Added getOutermostNode function

* Fix tight spacing not applied

* Add surrounding argument to html.buildExpression

It is an array consisting type of nodes that will be added to the left
and the right, and if given, will be used to determine bin cancellation
and spacings of outermost nodes.

* Fix html.buildExpression call in leftright

* Add dummy span only when given

* Update buildHTML.js
2018-02-13 07:01:56 -05:00
Kevin Barabash
9b2101f6b4 move metrics to katex-fonts submodule (#1134)
* move metrics to katex-fonts submodule

* update katex-fonts submodule

* update katex-fonts submodule after pulling down changes
2018-02-11 16:36:13 -05:00
ylemkimon
3f69de5036 Update NPM scripts and documentation (#1146)
* Group more test npm scripts into `test:`

* Update documentations on the development workflow

* Update .travis.yml to match updated NPM scripts

* Run npm install in Travis
2018-02-11 16:11:59 -05:00
Ron Kok
d80be86015 Support Unicode colon equals (#1151)
* Support Unicode colon equals

This PR adds support for three Unicode characters: `≔` `≕` `⩴`

* Fix error in \Coloneqq
2018-02-09 07:58:23 -05:00
ylemkimon
383a68b935 Remove Makefile and migrate to NPM scripts (#1135)
* Remove Makefile and migrate to NPM scripts

* Update documentation/.arclint

* Check node version in prestart

* Group test npm scripts into `test:`
2018-02-06 12:39:24 -05:00
Ron Kok
73d80f595c Add \nobreakspace (#1145) 2018-02-05 21:17:36 -05:00
Kevin Barabash
f977c25d0d set up code coverage (#1140)
* set up code coverage

* add coverage badge
2018-02-05 09:33:31 -05:00
Ron Kok
2aee354ca2 Support Reaction Arrows (#1078)
* Support Reaction Arrows

This PR is written to supply reaction arrows for a future `mhchem` extension. `mhchem` uses seven reaction arrows. Four of them correspond to extensible arrows already available in KaTeX. This PR creates the other three.

These arrows will also be useful to chemists writing about reactions when `mhchem` is unavailable.

Three new extensible arrows are introduced: `\xrightleftarrows`, `\xrightequilibrium`, and `\xleftequilibrium`.

These names are not `mhchem`’s user-facing function names. In `mhchem`, users would call these arrows with syntax such as: `\ce{A<-->B}`, or `\ce{A<=>>B}`, or `\ce{A<<=>B}`. I’ve provided names that look more like the other extensible arrow names. That’s probably worth some discussion.

* generate screenshots for ReactionArrows

* Increase overlap in arrow shaft

To prevent a small gap when rendering in very large font sizes.

* Adjust upper text vert alignment. Add warning.

* Limit alignment adjustment to \xleftequilibrium

* generate screenshots for reaction arrows
2018-02-04 15:52:22 -05:00
Ron Kok
ea3b6abe32 Enable spacing functions in text mode (#1139)
* Enable spacing functions in text mode

Spacing functions such as `\;` or `\quad` should be accepted in either math mode or text mode

* Add tests

* Fix tests

* Fix lint error
2018-02-04 13:58:04 -05:00
ylemkimon
30854eb866 Enable hot module replacement(HMR) (#1100)
* Use ES6 in static/main.js

+ Lint static/main.js

* Enable hot module replacement(HMR) in webpack-dev-server

* Disable no-console in static/main.js

* Use seperate entry point/bundle for the test page(/static/main.js)
2018-02-01 13:33:49 -05:00
Kevin Barabash
603f12df8d add support for unicode angle brackets, single vertical bar, double vertical bar (#1123)
* add support for unicode angle brackets

* add tests, remove vertical bar changes

* fix 'message not a function' errors
2018-01-31 20:03:16 -05:00
Erik Demaine
684df05a86 Add support for \mathring (#1125)
Fix #1124. \mathring is the math-mode equivalent to the \r accent.
Support follows from a rather trivial symbol aliasing,
plus (for Unicode support) listing it in `unicodeAccents.js`.
2018-01-31 19:48:23 -05:00
ylemkimon
58c4c7c4a4 Set webpack-dev-server host to 0.0.0.0 (#1122)
webpack-dev-server CLI has a default value of localhost, which only
allows accessing locally. Setting to 0.0.0.0 allows to access the server
from the external. However, the open option will open 0.0.0.0:7936,
which is an invalid address, so it has been removed.
2018-01-31 19:00:40 -05:00
Kevin Barabash
4bec90be0c extract font functions and implicit color function (#1119)
* extract font functions and implicit color function

* remove oldFontFuncs from Parser.js

* allow old font commands in text mode
2018-01-31 10:03:30 -05:00
Kevin Barabash
7b635f79cf move katex.less into src (#1120)
* move katex.less into src

* fix remaining paths for katex.less
2018-01-30 23:53:02 -05:00
Erik Demaine
95d5c59d31 Italic Greek capital letters (#1118) 2018-01-30 18:09:59 -05:00
Kevin Barabash
f80d0afee8 extract sizing and styling implicit functions (#1116)
* extract sizing and styling implicit functions

* add BreakToken type
2018-01-30 07:13:01 -05:00
Kevin Barabash
03c5ce7f87 add perf tests, fixes #1053 (#1054) 2018-01-29 20:38:14 -05:00
Kevin Barabash
cf6743b2a8 Bump master to v0.10.0-pre 2018-01-28 23:41:01 -05:00
Kevin Barabash
2f88b093fb update package-lock.json so that release.sh will work 2018-01-28 23:39:11 -05:00
Kevin Barabash
bf080cd6a4 remove symlink to support devs using Windows (#1090) 2018-01-28 23:01:57 -05:00
Kevin Barabash
0eae99fb08 add \S and \P (#1110) 2018-01-28 17:32:19 -05:00
Ryan Randall
64d776eb4e Merge pull request #1101 from Khan/bolditalic
add Main-BoldItalic font to allow nesting of \textit and \textbf
2018-01-28 15:06:01 -05:00
Ryan Randall
097d592b47 Merge branch 'master' into bolditalic 2018-01-28 14:54:35 -05:00
Kevin Barabash
c627de04d9 use correct spacing with tight styles (#1106) 2018-01-27 22:12:25 -05:00
Kevin Barabash
ea7a560191 add Main-BoldItalic font to allow nesting of \textit and \textbf 2018-01-27 11:32:14 -05:00
ccorn
e4fe1c89d4 Fixes #1093 (non-portable use of String method .includes) (#1097) 2018-01-27 00:54:14 -05:00
Kevin Barabash
f03849c831 update fonts and metrics so that accents are positioned correctly (#1094)
* update fonts and metrics so that accents are positioned correctly

* fix degree symbol, move more accents into the 0x2c0-0x2df range

* fix accents in Unicode screenshots

* update jest snapshots, update AccentsText to include requested characters

* update fonts submodule, add unicode chars to AccentsText test

* update submodules after merging its PR
2018-01-26 19:46:57 -05:00
David Flanagan
53203ed92c Add a screenshot test to ensure that we don't inherit svg-only CSS properties (#1092)
We want to inherit CSS properties that apply to both text and SVG
but we don't want to inherit styles that affect SVG without affecting text.

This patch adds a screenshot test to verify this.
2018-01-25 14:02:06 -05:00
David Flanagan
7b5083f982 Don't inherit SVG style properties from the environment. (#1089)
* Don't inherit SVG style properties from the environment.

We don't want to inherit styles that affect SVG painting unless those
styles also affect regular text rendering. This patch adds styles
to the stylesheet so that every svg element in KaTeX output starts
off with a known set of basic fill and stroke attributes.

This should resolve issue #1088

* Default to stroke:none for <path> elements
2018-01-25 09:01:37 -05:00
Kevin Barabash
63f541b6e6 Use JS for spacing between atoms instead of CSS (#1070)
* Use JS for spacing between atoms instead of CSS

Summary:
This is the first step towards creating an intermediate representation
that can be used to generate HTML, SVG, and Canvas commands for rendering.
By generating spans that contain the width of the spaces instead of
relying on CSS sibling rules we'll be able to one day replaces the spans
with intermeidate 'Glue' nodes (in a later PR).

An added benefit of this approach is that is enables us to programmatically
change the values for thinspace, mediumspace, and thickspace which will
allow us to implement the \setlength command.

Test Plan:
- npm test
- dockers/Screenshotter/screenshotter.sh --verify

* fixed failures in BinCancellation, BoldSymbol, and OperatorName

* update screenshots

* don't use current size when determining size of spaces, update more screenshots

* fix spacing in SizingBaseline and StyleSwitching

* actually do the right thing for sizing groups

* fix \not for Chrome and Firefox

* do TODOs

* address feedback from the code review

* fix issue in delimsizing.js

* add TODO to think about a better solution in href.js

* fix typos, simplify href, be honest about paddingLeft for \not
2018-01-24 23:03:36 -05:00
ylemkimon
d82424c618 Fix undefined devServer.app in screenshotter (#1085)
Fixes #1082, `TypeError: Cannot read property 'get' of undefined` on
Docker for Mac.
2018-01-23 11:58:07 -05:00