Commit Graph

1223 Commits

Author SHA1 Message Date
Ron Kok
c7145f0ff0 Alpha sorted function support page (#1536)
* Alpha sorted function support page

* Pick up comments

* Pick up review comments

* Pick up more comments

* Add more links

* Add \pu
2018-08-03 03:11:27 +09:00
Ashish Myles
7e97a382ec Introduce "atom" parse node to coalesce various symbol nodes. (#1541) 2018-08-02 20:46:40 +09:00
Erik Demaine
30be53efe6 Fix \textdaggerdbl (#1539)
Fix #1538 by correcting the symbol mapping for `\textdaggerdbl`
2018-08-02 08:33:39 +09:00
Ashish Myles
0ac4b6e89d Convert ParseNode to struct (#1534)
* Define the nested version of ParseNodes structs explicitly.

Passes test:jest, but fails test:flow.

* Fix additional type errors reported by flow.

* Migrate rebased code from master.

* Rename ParseNode.js to parseNode.js.

* Update defineEnvironment output type to fix the flow errors in environment/array.js.
2018-08-01 15:41:27 +09:00
Erik Demaine
2202aa774f Comments without terminating newlines, \href fixes, \url support (#1529)
* 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
2018-07-31 14:13:30 -04:00
Ron Kok
b73e43832b Improve Unicode docs (#1533)
* Improve Unicode docs

* Edit table
2018-08-01 01:43:55 +09:00
Erik Demaine
41892af1a3 Typo in \hspace*, cleanup TeX commands (#1532) 2018-07-30 17:15:31 -07:00
ylemkimon
c06b36cb6a Replace yarn run and yarn install with yarn, remove building with npm instructions (#1528)
* Replace `yarn run` with `yarn`

* Replace `yarn install` with `yarn`

* Remove building using `npm` from node.md
2018-07-30 14:31:25 +09:00
Erik Demaine
c88fa70a62 Small tweaks to documentation (#1527) 2018-07-30 12:25:38 +09:00
ylemkimon
a76c4b9a2f Switch npm to Yarn (#1522)
* Add testUrl to jest config

* Switch npm to Yarn
2018-07-29 11:36:27 -07:00
ylemkimon
702b3c807f Add Building from Source & update Security documentation (#1516)
* Add `Building from Source` documentation

* Update security.md documentation

* Fix grammars
2018-07-30 03:18:44 +09:00
ylemkimon
e97a23ec6d Set baseUrl depending on the environment (#1526) 2018-07-29 11:04:32 -07:00
ylemkimon
cd80db5ded Fix docUrl and pageUrl in the Footer & image path (#1514)
* Fix docUrl and pageUrl in the Footer

* Fix katex-comparison.gif path

* Fix typo in the url to `supported`
2018-07-29 13:40:10 -04:00
ylemkimon
edede0867d Add codecov as devDependencies (#1524)
* Add codecov as devDependencies

* Update CI commands
2018-07-30 02:15:25 +09:00
ylemkimon
2136c9670c Remove .travis.yml and related (#1523) 2018-07-29 13:07:40 -04:00
ylemkimon
20c9440318 Add markdown-help command and auto-generate CLI documentation (#1518)
* Add `markdown-help` command and update CLI documentation

* Auto-generate cli.md before start, build, and publish

* Update cli.md.template
2018-07-30 01:44:43 +09:00
ylemkimon
c1b6668cf0 Improve README.md (#1515)
* Fix KaTeX logo

* Add npm badge

* Change CircleCI badge

* Remove redundant links

* Remove unnecessary details

* Add a link to auto-render extension

* Add a link to the list of supported commands

* Add a section about auto-render extension

* Update README.md
2018-07-29 12:26:41 -04:00
Ron Kok
3cce293a02 Add size graphic to function support page, fix vertical alignment (#1517)
* Add size graphic to supported

* Add indents

* Fix environment vertical alignment
2018-07-29 02:43:15 +09:00
ylemkimon
db2aecce24 Lint website (#1519)
* Lint website

* Add comment to empty_thead.js
2018-07-28 10:49:36 -04:00
ylemkimon
4114288403 Improve supported functions documentation (#1511)
* Remove empty lower right cells

* Escape backticks(`) using <code></code>

* Escape vertical bars(|) using <code> and HTML entity code

* Normalize documentation links

* Remove empty thead
2018-07-27 18:23:49 -07:00
ylemkimon
8a38035855 KaTeX website & documentation (#1484)
* website/docs: initial commit

* Change secondaryColor

* Fix index.css not being copied and included on global stylesheet

* Fix stylesheet link

[skip ci]

* Change documentation link to API(Usage)

[skip ci]

* Add `Libraries` in usage

[skip ci]

* Remove documentation from `README.md` and add link to the site

[skip ci]

* Use KaTeX in the parent directory to build Markdown

[skip ci]

* Revise function support page. Avoid error msgs.

* General edit to function support page
2018-07-26 20:19:40 -07:00
ylemkimon
83e8eac0a5 Add test job to CircleCI (#1235)
* Do not compile contrib when running screenshotter

* Add test job to CircleCI

* Update config.yml

* Fail if PR exists but running on the forked repo

* Update Screenshotter README.md

* Store artifact at the root

* Add CircleCI badge

* Add `codecov` to CircleCI

* Change build directory to `dist`
2018-07-26 18:50:51 -07:00
Erik Demaine
e454eb3b3e Screenshotter chdir to KaTeX root directory (#1502)
* Screenshotter chdir to KaTeX root directory

Fix #1501.  This seems to be required for webpack, specifically
`babel-plugin-version-inline`, to run correctly.

* lint fix
2018-07-25 03:32:01 +09:00
Erik Demaine
9fe5e221e5 Switch from nomnom to commander (#1496)
* 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
2018-07-23 13:16:45 -04:00
Erik Demaine
cbd3afd738 Fix \not vertical alignment (#1497)
* 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
2018-07-24 02:01:02 +09:00
ylemkimon
237986a7ca Change build directory to dist and cleanup NPM scripts (#1500)
* Move the build path to `dist`

* mkdir dist if not exists

* Remove build from .gitignore

* Delete `dist/` before building and when cleaning
2018-07-23 12:46:15 -04:00
Ron Kok
b43ed4b645 Support \pmb (#1418)
* 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
2018-07-22 17:46:12 -04:00
Erik Demaine
74fb394bb5 Update fonts to remove \neq and \notin glyphs (#1499)
See https://github.com/KaTeX/katex-fonts/pull/53
2018-07-23 01:58:21 +09:00
greenkeeper[bot]
78870abbe8 Update css-loader to the latest version 🚀 and use postcss-loader and cssnano to minimize CSS (#1464)
* chore(package): update css-loader to version 1.0.0

* Require minimum Node 6.9

* Use `postcss-loader` and `cssnano` to minimize CSS

* chore(package): update lockfile

* Remove unnecessary `ident` and function

* chore(package): update cssnano to version 4.0.1
2018-07-22 15:37:19 +09:00
ylemkimon
71035c7111 Refactor test helpers (#1336)
* 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`
2018-07-21 19:06:07 -07:00
ylemkimon
c9947220b6 Remove codes that require expensive polyfill (#1469)
* Revert "Cleanup domTree.js to re-use code (#1305)"

This reverts commit 9bb48b83f1.

* Cleanup domTree.js to re-use code

* Extract common constructor/methods into functions

* Remove for...of

* Added eslint rule to disallow for...of

* Remove array destructuring

* Added eslint rule to disallow array destructuring

* Add eslint rule to disallow class inheritance

* Remove Object.keys and Object.assign

* Do not polyfill Object.freeze

* Babel: enable loose mode

* Undo disabling `linebreak-style`

* Move `children` initialization out of `initNode`

* Blacklist files for `no-restricted-syntax`

* Revert "Remove array destructuring"

This reverts commit c9d52c2db31c68cca77fea6ad774ee58b0632ff3.
2018-07-21 18:57:07 -07:00
Kevin Barabash
8eed4e2795 update fonts to use \not character without left side-bearing correction, fixes #1189 (#1267)
* update fonts to use \not character without left side-bearing correction, fixes #1189

* update katex-fonts submodule

* update katex-fonts submodule

* add comment

* Update fonts submodule

* Update screenshots
2018-07-22 04:17:07 +09:00
greenkeeper[bot]
e5cb511f5a chore(package): update flow-bin to version 0.77.0 (#1493)
* chore(package): update lock file
2018-07-21 20:18:44 +09:00
Ashish Myles
7150c2550d Port buildMathML to @flow. (#1486)
* Port buildMathML to @flow.

* Update code after sync. Address reviewer comments.
2018-07-18 23:04:41 +09:00
Erik Demaine
578877764d \@binrel command and refactor (#1487)
* \@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
2018-07-17 19:49:50 -07:00
Ron Kok
8f5239c272 Fix \operatorname (#1461)
* Fix operatorname

* Update MathML

* Update screenshots

* Fix lint error

* Pick up comment

* Remove duplicate lines

* Fix lint error

* Remove duplicate code

* Replace \pi with \Pi in test

* Revise RegEx

* Update RegEx
2018-07-17 02:08:41 +09:00
Ashish Myles
f0976ade26 Refactor documentFragment and implement both HtmlDomNode and MathDomNode interfaces (stepping stone to port buildMathML to flow) (#1478)
* Make MathNodeClass include documentFragment for ergonomics.

* Separate out the HTML and MathML documentFragments.

These two documentFragments have different additional properties/methodsi
and limitations. This separation is needed for porting buildMathML to
flow.

* Coalesce the documentFragment subclasses to avoid subclassing polyfill.

* Make DomSpan and SvgSpan type aliases again instead of subclasses.

* Remove type MathNodeClass in favor of MathDomNode.

* Resolve $FlowFixMes by reordering variants of a union type.
2018-07-16 15:41:27 +09:00
ylemkimon
48e9058a06 Inline version using babel-plugin-version-inline (#1475)
* Inline version using `babel-plugin-version-inline`

* Fix `unicodeSymbols.js` generation
2018-07-16 03:41:03 +09:00
ylemkimon
9783ac1466 Make unicodeAccents.js ES6 module (#1477)
Use `babel-register` in `unicodeMake.js` to require ES6 module.
2018-07-15 13:54:54 -04:00
Erik Demaine
b7277049a4 \char character escaping and nicer MathML via \html@mathml (#1454)
* \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
2018-07-14 08:36:23 -04:00
Erik Demaine
33ef4bdc63 AsciiMath: link to asciimath2tex (#1474) 2018-07-13 14:19:59 +09:00
ylemkimon
747a98555d Remove tree cloning before building HTML (#1470)
* Reset `supSub.value.base` after building `supSubGroup`

* Remove tree cloning before building HTML

`buildExpression` is no longer destructive, added comment regarding it,
2018-07-12 00:28:56 +09:00
ylemkimon
35aece7763 Set documentFragment.style to empty object (#1471)
Remove `style` getter and setter in `documentFragment`
2018-07-11 11:09:42 -04:00
Ron Kok
db585fae54 Support \genfrac and \above (#1458)
* Support \genfrac and \above

* Accommodate delimiters inside groups

* Update screenshots take one`

* Update screenshots take two

* Fix flow error

* Fix lint error
2018-07-07 17:01:37 -07:00
ylemkimon
0fb71c8bf8 Lint webpack.*.js (#1467)
* Lint webpack.*.js

* Fix webpack.analyze.js style
2018-07-07 13:17:05 -04:00
greenkeeper[bot]
00c91cdc35 chore(package): update flow-bin to version 0.76.0 (#1465)
* chore(package): update flow-bin to version 0.76.0

* chore(package): update lockfile
2018-07-08 00:07:14 +09:00
Ron Kok
f3c167c601 Support Unicode corners (#1459)
* Support Unicode corners

* Fix \lrcorner
2018-07-02 07:53:29 +09:00
Ron Kok
c599c613f0 Refactor genfrac.js (#1455) 2018-06-29 03:09:59 +09:00
ylemkimon
a8015d0feb Allow only allowed protocols in \href (#1440)
* Allow only allowed protocols in \href

Added `allowedProtocols` settings

* Fix a typo

* Allow boolean argument

* Allow wildcard(*) argument

Revert 'Allow boolean argument'
2018-06-27 19:51:12 -04:00
Ron Kok
8621f5b76a Support \brace and \brack (#1453)
* Support \brace and \brack

* Update screenshots
2018-06-28 03:43:02 +09:00