21 Commits

Author SHA1 Message Date
Int Fract
4f1d916674 fixed spelling error (#3845)
changed "its on line" to "its o**w**n line"
2023-08-05 14:01:38 +00:00
Erik Demaine
bdb0be2017 fix: Support \let via macros option (#3738)
* fix: Support `\let` via `macros` option

Issue #3737 turned out to be how we handled the return value of `expandOnce`.
We assumed that, if the return value isn't an `Array`, it's an
`instanceof Token`.  This isn't necessary true with a user's `macros`
object, and given that we don't currently export `Token`, it's pretty
difficult to bypass.

Given that we never actually use the array return values from
`expandOnce`, I changed the return value for `expandOnce` to either a
`number` (to indicate the number of expanded tokens, so you could still
look up the tokens in the stack if you wanted to) or `false`
(to indicate no expansion happened).  We can't use `0` for the latter
because an actual expansion might result in zero tokens.
The resulting code is arguably cleaner.

I also documented that `macros` can have object expansions, and
specified how to simulate `\let`.

Fixes #3737

* Revise macros documentation according to comments
2023-04-17 19:59:56 +00:00
Nico Schlömer
beed61fd95 doc: improve globalGroup description regarding macros object (#3567)
* Better doc for `globalGroup`
* Mention `globalGroup` in `macros`
* Example uses `macros` argument passed to multiple examples
* Include `renderToString` example that sets `macros`

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2022-02-21 16:55:16 -05:00
ylemkimon
f007358c0f chore: rename branch master to main (#3376)
* chore: rename branch master to main

* ci: update semantic-release config

* ci: run semantic release only on main
2021-10-31 01:32:44 +09:00
Erik Demaine
877e725620 refactor: separate defineMacro.js from macros.js (#3198)
Allows defineMacro to be called from other places, in particular
removing cycles from the dependency graph.
2021-08-28 05:15:22 +09:00
Mingye Wang
7933729701 docs: mention wrapping in inline mode (#2972)
* docs: mention wrapping in inline mode

* Apply suggestions from code review

Co-authored-by: Erik Demaine <edemaine@mit.edu>

* Add some CSS examples. 

* fixup! docs/issues: remove fleqn thing

* Minor tweaks

* Link to custom CSS

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2021-05-12 14:32:14 +00:00
deining
29d7a2ad7d docs: minor documentation fixes (#2852)
Co-authored-by: ylemkimon <y@ylem.kim>
2021-03-24 02:54:36 +09:00
Ron Kok
903b459ca4 Update \color documentation (#2370)
* Update \color documentation

* Update options.md

* Add version numbers.

* Remove MathJaX version number.
2020-08-01 17:53:55 -04:00
ylemkimon
e5333ad04d Add HTML extension (#2082)
* Add html extension

* Fix flow error

* Update documentation

* Add tests

* Call buildA11yStrings for "html" node

* Throw ParseError when parsing \htmlData fails

* Improve documentation

* Add a screenshotter test

* Add dummy screenshot

* Update screenshots
2019-12-01 17:49:28 -05:00
kzvi
0843e9556e add spacing on left of fleqn display math (#2127)
* add spacing on left of fleqn display math

* update description of fleqn in docs/options.md

to include new spacing
2019-10-18 12:22:52 -04:00
Ciro Santilli,Opinions and content are my own, not my employer's,2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱scriptalert(1)/script
36595343b7 Create globalGroup option to place definitions in global scope (#2091)
If true, this allows \newcommand definitions to persist across calls to
renderToString.

Fix https://github.com/KaTeX/KaTeX/issues/2070
2019-09-22 15:03:44 -04:00
Erik Demaine
3800dc49c1 [breaking] trust setting to indicate whether input text is trusted (#1794)
* 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
2019-07-08 21:57:23 -04:00
Ron Kok
f9dafea6a6 Enable minRuleThickness in rendering options (#1964)
* Enable minRuleThickness in rendering options

* fix typo

* Fix lint errors

* Fix default

* Remove border from \colorbox

* Fix lint error

* Update array screenshot

* Add border to \fcolorbox

* Edit comment

* Add comment

* Pick up review comments

* Fix lint errors

* Edit \sqrt screenshot test

* Update screenshots

* Screenshot update take 2

* Improve \sqrt SVG paths

* Fix lint error
2019-05-25 18:39:16 -04:00
Ron Kok
9822414733 Render MathML directly (#1966)
* Render MathML

* Fix lint error

* Change from main api to rendering options
2019-05-13 19:31:04 -04:00
Erik Demaine
7f778d1543 leqno and fleqn support (#1814)
* leqno support

* Add fleqn support

* Add tests

* Lint fix

* Add leqno and fleqn to website demo
2019-01-29 18:40:17 +09:00
Ron Kok
f5234a2f01 Fix \hphantom width (#1809)
* Fix \hphantom width

* Spin up phony screenshot test

* Make better choice of smash screenshot test

* Real screenshotter test

* Add strict mode

* Fix lint error

* useStrictBehavior

* Revert to previous strict setting

* useStrictBehavior "phantomSpacing"

* Fix tests via nonstrictSettings

* Fix documentation

* Remove bin|rel
2019-01-02 01:49:23 +09:00
ylemkimon
112582daa5 Replace Khan/KaTeX with KaTeX/KaTeX (#1781)
* Replace Khan/KaTeX with KaTeX/KaTeX

* Remove RawGit links

* Remove old files
2018-11-19 21:24:33 -05:00
ylemkimon
8f95a275fb Add documentation about macro functions (#1602)
* Add documentation about macro functions

* Update options.md
2018-08-13 03:47:39 +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
Erik Demaine
c88fa70a62 Small tweaks to documentation (#1527) 2018-07-30 12:25:38 +09: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