mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-10 21:48:41 +00:00
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
This commit is contained in:
@@ -27,9 +27,7 @@ exports[`A begin/end parser should grab \\arraystretch 1`] = `
|
||||
"end": 37,
|
||||
"lexer": {
|
||||
"input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
|
||||
"tokenRegex": {
|
||||
"lastIndex": 56
|
||||
}
|
||||
"lastIndex": 56
|
||||
},
|
||||
"start": 36
|
||||
},
|
||||
@@ -58,9 +56,7 @@ exports[`A begin/end parser should grab \\arraystretch 1`] = `
|
||||
"end": 39,
|
||||
"lexer": {
|
||||
"input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
|
||||
"tokenRegex": {
|
||||
"lastIndex": 56
|
||||
}
|
||||
"lastIndex": 56
|
||||
},
|
||||
"start": 38
|
||||
},
|
||||
@@ -91,9 +87,7 @@ exports[`A begin/end parser should grab \\arraystretch 1`] = `
|
||||
"end": 42,
|
||||
"lexer": {
|
||||
"input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
|
||||
"tokenRegex": {
|
||||
"lastIndex": 56
|
||||
}
|
||||
"lastIndex": 56
|
||||
},
|
||||
"start": 41
|
||||
},
|
||||
@@ -122,9 +116,7 @@ exports[`A begin/end parser should grab \\arraystretch 1`] = `
|
||||
"end": 44,
|
||||
"lexer": {
|
||||
"input": "\\\\def\\\\arraystretch{1.5}\\\\begin{matrix}a&b\\\\\\\\c&d\\\\end{matrix}",
|
||||
"tokenRegex": {
|
||||
"lastIndex": 56
|
||||
}
|
||||
"lastIndex": 56
|
||||
},
|
||||
"start": 43
|
||||
},
|
||||
|
Reference in New Issue
Block a user