mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-10 21:48:41 +00:00
Fix \\ and \newline after operator (#1796)
* Fix \\ and \newline after operator Fix #1790. `\\` and `\newline` render as a span with classes `mspace` and `newline`. We need to check for `newline` when bringing spaces into the same `base` group. * Add tests and comment
This commit is contained in:
committed by
Kevin Barabash
parent
1a7ce6cf15
commit
8346294bf3
@@ -334,10 +334,11 @@ export default function buildHTML(tree: AnyParseNode[], options: Options): DomSp
|
||||
expression[i].hasClass("mrel") ||
|
||||
expression[i].hasClass("allowbreak")) {
|
||||
// Put any post-operator glue on same line as operator.
|
||||
// Watch for \nobreak along the way.
|
||||
// Watch for \nobreak along the way, and stop at \newline.
|
||||
let nobreak = false;
|
||||
while (i < expression.length - 1 &&
|
||||
expression[i + 1].hasClass("mspace")) {
|
||||
expression[i + 1].hasClass("mspace") &&
|
||||
!expression[i + 1].hasClass("newline")) {
|
||||
i++;
|
||||
parts.push(expression[i]);
|
||||
if (expression[i].hasClass("nobreak")) {
|
||||
|
Reference in New Issue
Block a user