Can't escape $
in math
#7
Labels
🙅 no/wontfix
This is not (enough of) an issue for this project
👎 phase/no
Post cannot or will not be acted on
Initial checklist
Affected packages and versions
[email protected]
Link to runnable example
https://github.com/nvlang/micromark-extension-math-bug
Steps to reproduce
npm i
(orpnpm i
)node index.js
Expected behavior
$ a \$ b $
should be parsed as an inline math node withcontent
a \$ b
.Actual behavior
$ a \$ b $
is parsed as follows:$ a \$
: math node with contenta \
b $
: text node with contentb $
Runtime
Node v16
Package manager
pnpm
OS
macOS
Build and bundle tools
No response
Edit
I just looked at this package's unit tests and noticed that this seems to be the expected behavior. I'm guessing the idea is to replicate the behavior from backticks. I suppose that this makes this not a bug report, but rather a matter of personal preference. However, I do believe that there is an argument in favor of the behavior I expected: it mirrors the behavior inside TeX documents.
I understand that there are advantages to having
$
behave like backticks; the main one that comes to mind is the ability to have math within text within math, i.e.,$$\text{$x$}$$
$\text{$x$}$. However, that behavior is still reconcilable with the behavior I expected.The text was updated successfully, but these errors were encountered: