mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-04 18:58:39 +00:00
* Support for top-level \newline and \\ in inline math This was a little tricky because `\\` was defined as an endOfExpression. Instead made `\\` a termination specific to an array environment. Outside an array environment, buildHTML handles the `cr` object, resulting in a `.newline` class. Currently this turns into a `display: block` (with appropriate vertical spacing) only in inline math, matching LaTeX. * Simplify code * Fix Jest errors * NewLine screenshot test * Bug fix: \\ only works at top level of inline * Add \newline and \cr to test * Switch test to pmatrix * Add vertical space test * Add \\ vs. \newline tests * Fix flow errors * Add \cr test * Add documentation for \\ at top level * Comment out newRow * Fix commenting out
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
// @flow
|
|
|
|
/**
|
|
* This file consists only of basic flow types used in multiple places.
|
|
* For types with javascript, create separate files by themselves.
|
|
*/
|
|
|
|
export type Mode = "math" | "text";
|
|
|
|
// LaTeX argument type.
|
|
// - "size": A size-like thing, such as "1em" or "5ex"
|
|
// - "color": An html color, like "#abc" or "blue"
|
|
// - "url": An url string, in which "\" will be ignored
|
|
// - if it precedes [#$%&~_^\{}]
|
|
// - "original": The same type as the environment that the
|
|
// function being parsed is in (e.g. used for the
|
|
// bodies of functions like \textcolor where the
|
|
// first argument is special and the second
|
|
// argument is parsed normally)
|
|
// - Mode: Node group parsed in given mode.
|
|
export type ArgType = "color" | "size" | "url" | "original" | Mode;
|
|
|
|
// LaTeX display style.
|
|
export type StyleStr = "text" | "display" | "script" | "scriptscript";
|
|
|
|
// Allowable token text for "break" arguments in parser
|
|
export type BreakToken = "]" | "}" | "$" | "\\)" | "\\\\";
|