* 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
* 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>
* 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>
* 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
* 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
* 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
* 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