Tutorials 26 min read

Write Two Prices in a Note and the Words Between Them Can Turn Into Math

MMNMNOTE
dollar sign in markdownescape dollar signmarkdown mathlatex in noteskatexobsidian dollar signgithub mathpandoc

Write two prices in a note — Lunch was $12 and dinner was $30 — and some Markdown math engines pair the two dollar signs, delete them, and set 12 and dinner was in a math font. The fix is a backslash before each price's dollar sign: \$12. In our test it held in every math-enabled engine.

Whether that happens depends on the engine, because the rule was never settled. micromark-extension-math, the parser behind remark-math, admits the conflict in its own options table: single dollars "work in Pandoc and many other places, but often interfere with “normal” dollars in text."1 It still ships with single-dollar math switched on.

On 15 November 2026 we ran eight one-line price notes through 15 configurations of seven Markdown renderers.2 Fourteen had single-dollar math on. Four of those turned all eight lines into math — two of them as shipped defaults. Nine turned none. One turned a single line into math.

A backslash before each price kept it literal in all fifteen.

The question is not new. Stack Overflow's "Escaping dollar sign in ipython notebook" dates from April 2013. It has been viewed 58,914 times.3 What the answers rarely say is which engines need the escape, and where the popular alternative quietly fails. That is the table below — with receipts.

Why do the words between two prices turn into math?

Because a math extension reads $…$ as inline math, and two prices supply both delimiters. Careful engines test the characters beside each $ — no space just inside, no digit right after the closing one — and ordinary prices fail that test. Permissive engines pair any two dollar signs on a line, so the words between them become the equation.

Pandoc states the strictest version of the rule. After the spacing requirement, its User's Guide adds that the closing $ "must not be followed immediately by a digit. Thus, $20,000 and $30,000 won’t parse as math."4

Walk the budget line through that rule. In $12 and dinner was $30, the second dollar sign has a space on its left and a digit on its right. It fails twice as a closing delimiter — so pandoc leaves the sentence alone.

PyMdown Extensions' arithmatex uses the spacing half of the rule, which it calls smart_dollar. The requirement, its docs say, is there "to help avoid false positives when using the dollar sign in traditional ways such as: I have $2.00 and Bob has $10.00."5 Without the digit clause, one price range still slipped through in our run: $5-$10, where only a hyphen stands between the first price and the second sign.

The permissive engines skip the test entirely. Here is what micromark-extension-math, with its default options, rendered as math from three of our test lines:2

Input:  Lunch was $12 and dinner was $30 last night.
Math:   "12 and dinner was "

Input:  Between $20,000 and $30,000 a year.
Math:   "20,000 and "

Input:  apple 5$ banana 3$ bread 1$
Math:   " banana 3"

The dollar signs vanish. The words between them go into a math font. The last line is a shopping list written with the sign after the number, and it breaks the same way.

Which Markdown engines turn prices into math?

Four of the 15 configurations turned all eight price lines into math: micromark-extension-math and mdit-py-plugins' dollarmath as shipped, plus opt-in switches in marked-katex-extension and arithmatex. Pandoc, GitHub and the three markdown-it KaTeX plugins turned none. The last two columns show that "none" is not the same as safe.

ConfigurationPrice-only lines turned into math (of 8)It costs $5 and the area is $x^2$ here.GitHub's <span>$</span>100 example
pandoc 3.13 markdown / gfm / commonmark_x0only x^2 is mathworks
GitHub, POST /markdown (gfm)0only x^2 is mathworks
@vscode/markdown-it-katex 1.1.20only x^2 is mathworks
markdown-it-katex 2.0.30only x^2 is mathworks
markdown-it-texmath 1.0.00red KaTeX errorred KaTeX error
marked-katex-extension 5.1.13, default0red KaTeX errorred KaTeX error
arithmatex 13.1, default (smart_dollar)1 ($5-$10)only x^2 is mathworks
dollarmath 0.7.0, allow_space=False, allow_digits=False0only x^2 is mathworks
micromark-extension-math 3.1.0, default8words swallowed, equation lostwords swallowed
dollarmath 0.7.0, default8words swallowed, equation lostwords swallowed
marked-katex-extension, nonStandard: true8words swallowed, equation lostwords swallowed
arithmatex, smart_dollar: False8words swallowed, equation lostwords swallowed
micromark-extension-math, singleDollarTextMath: false0no single-dollar math at allno single-dollar math at all

Own receipt, 15 November 2026: eight price lines plus 13 control and mixed lines, each package at its latest release that day.2 "Math" means the output HTML carried a math span or a math error. GitHub's API marks which text it hands to its math renderer; we did not load the page in a browser.

Two of the permissive rows are opt-ins. marked-katex-extension's README describes nonStandard as the switch for formulas "without spaces before and after $ or $$."6 Arithmatex's smart_dollar is on unless you turn it off.

The other two are defaults. micromark-extension-math documents singleDollarTextMath as "default: true".1 The dollarmath plugin's signature sets both allow_space and allow_digits to True.7

Reach is not configuration. npm counted 18,279,323 downloads of micromark-extension-math in the week of 7–13 November 2026. remark-math had 13,207,912.8 Those numbers say how many builds carry the parser, not how many sites write math with a single dollar.

Is a line with a price and an equation safe?

Not in six of the 14 math-on configurations. Put a bare price before a real equation and its dollar sign can pair with one of the equation's — even in two engines that never touched a price-only line. Those two showed a red KaTeX error; the four permissive engines swallowed the words. An escaped price fixed all 14.

The test line was It costs $5 and the area is $x^2$ here.9 markdown-it-texmath and marked-katex-extension's default mode — both 0 of 8 on prices alone — tried to typeset 5 and the area is $x^2 and failed in red.

The cause sits in their patterns. texmath's inline rule allows a dollar sign inside the span it matches. marked-katex-extension's default rule checks only the character after the closing $.10 On the price-only lines, no later dollar sign qualified as a closing one. Add an equation, and its closing dollar does.

The four permissive engines rendered 5 and the area is as math and left x^2$ as stray text. The equation the line was written for never rendered.

Order matters. The area is $x^2$ and it costs $5. — the price after the equation — came through clean in all 14.9

So the careful list is shorter than the first table suggests. Pandoc, GitHub, @vscode/markdown-it-katex, markdown-it-katex, arithmatex's default and the strict dollarmath settings kept the mixed line intact. The rest needed the backslash.

How do I write a dollar sign so it stays a dollar sign?

Put a backslash before every price's dollar sign: \$12. In CommonMark-style Markdown a backslash before punctuation is an escape, so the reader sees $12 and the math extension never sees a delimiter. It displayed as $5 in all 14 math-enabled configurations. A few older plain-Markdown renderers show the backslash instead.

Leave the equation's own dollar signs alone. Only the money gets the escape:

Before:
Lunch was $12 and dinner was $30 last night.
It costs $5 and the area is $x^2$ here.

After:
Lunch was \$12 and dinner was \$30 last night.
It costs \$5 and the area is $x^2$ here.

In our run, escaped prices stayed text in all 15 configurations, and on the escaped mixed line only x^2 was math in all 14 math-on ones.911

The caveat is real. Python-Markdown with no math extension printed It cost \$5 and then \$10. — backslashes visible. So did pandoc's markdown_strict. Both follow the original Markdown escape list, which never included $.11 Load arithmatex into the same Python-Markdown and \$5 displayed as $5. Our guide to the everyday text Markdown turns into formatting covers which renderers honour which escapes.

There is a fair objection. Replying to the backslash workaround on the Obsidian forum in 2021, one user wrote: "But it reduces readability — a core reason for using Markdown in the first place — and portability as well."12 For a ledger-style table, code spans are the cleaner choice: `$5` stayed text in all 15 configurations.13 Write the dollar sign inside the backticks, never `\$5` — inside a code span the backslash is printed.

What about GitHub's span-tag advice?

GitHub Docs recommends a backslash inside a math expression and <span>$</span> outside one, on the same line. That is accurate for GitHub. It is not portable: GitHub's own example broke in six of the 14 math-on configurations we ran, while the backslash version worked in all 14. The span is a GitHub answer; the backslash is everyone's.

GitHub's documentation frames the problem precisely: "To display a dollar sign as a character in the same line as a mathematical expression, you need to escape the non-delimiter $ to ensure the line renders correctly."14 For the case outside an expression, it says: "Outside a math expression, but on the same line, use span tags around the explicit $."

We ran its example sentence, To split <span>$</span>100 in half, we calculate $100/2$.15 GitHub marked only 100/2 as math. So did pandoc, @vscode/markdown-it-katex, markdown-it-katex, arithmatex's default and the strict dollarmath settings.

The other six failed. texmath and marked-katex-extension's default produced a red error. The four permissive engines turned </span>100 in half, we calculate into math — markup and all.

Two more findings sharpen it. The same sentence with a bare $100 came back from GitHub's API with only 100/2 marked as math, so this example does not need the span there. And the span failed in exactly the engines where the bare dollar failed. To split \$100 in half… worked in all 14.15

The Markdown cheat sheet lists GitHub's form. Outside GitHub, use the backslash.

How do I check whether my app does this?

Paste three lines into the app or site you publish with and look at the rendered view. If any dollar sign disappears or any words turn italic, that renderer pairs dollars loosely. The test takes ten seconds and settles what no documentation page will tell you about your own setup — plugins included.

It cost $5 and then $10.
Plans run $5-$10 a month.
It costs $5 and the area is $x^2$ here.

Read the results this way:

  1. Line 1 breaks — the renderer pairs any two dollar signs. Escape every price.
  2. Only line 2 breaks — it uses the spacing rule without pandoc's digit clause, like arithmatex's default. Escape price ranges at least.
  3. Only line 3 breaks — prices alone are safe, but not beside an equation. Escape prices on any line with math.
  4. Nothing breaks — you are on a careful engine. Escaping still costs nothing, and the note will survive the next app.

Check every view the app has. Editors often render through a different path than the reading view — the Obsidian reports below are a split between surfaces, not one rule.

How do I fix the prices already in my notes?

Search for every dollar sign followed by a digit that has no backslash in front, escape those, and review the diff before saving. A short command does the first pass. The review catches what a pattern cannot read: equations that start with a digit, prices inside code spans, and prices written with the sign after the number.

The five-minute version:

  1. Back up the folder. Any bulk edit of plain text should start from a copy.
  2. List the candidates. From the notes folder, run grep -rnE '(^|[^\\])\$[0-9]' . to print every unescaped $ followed by a digit, with file and line.
  3. Escape one file into a new file. perl -pe 's/(?<![\\\$])\$(?=[0-9])/\\\$/g' budget.md > budget.escaped.md adds the backslash and skips dollars already escaped or doubled.
  4. Diff the two files. diff budget.md budget.escaped.md shows every change.
  5. Undo the wrong ones. An equation such as $2x+1$ starts with a digit and will be escaped by mistake. A code span such as `$99` will gain a backslash it will now print.
  6. Catch suffix prices by hand. 5$ and 3$ are not matched. grep -rnE '[0-9]\$' . lists them — along with equations that end in a digit — and each price becomes 5\$.
  7. Re-run the ten-second check on one fixed note.

We ran steps 2–4 on a sample note: two price lines, a range, an escaped pair, a mixed line and a code span.16 The escaped file kept every price as text in the 11 JavaScript and Python configurations, and GitHub's API marked only $x^2$ as math. It also showed the trap in step 5: GitHub printed the code span as \$99.

How do I stop it on a site I build?

Change the parser's settings instead of escaping every page. micromark-extension-math can turn single-dollar math off; mdit-py-plugins' dollarmath can require pandoc-like spacing and digit checks; arithmatex should keep its default; marked-katex-extension should stay without nonStandard. Each kept price-only lines at zero or one of eight in our run.

The thirty-minute version, per parser:2

Your site's settings may differ from the parser's defaults — frameworks and themes often pass their own options. Run the ten-second check on a built page, not on the parser's README.

For the opposite job — writing equations that do render — see Write the Equation, Not a Screenshot of It. For math pasted out of a chat answer in backslash-parenthesis form, see Copy an Equation Out of an AI Chat and the Backslashes Vanish.

Where has this shown up in real apps?

In Obsidian's views, in Cursor's chat panel and in Flowershow's published pages — each documented by the vendor's own staff or changelog. Obsidian's team says the behaviour is intended and points to the backslash. Cursor called its version a regression and fixed it. Flowershow changed its rule in 2026. Only the parsers above were tested here.

Obsidian. In March 2026 a user reported that a shopping list — apple 5$, banana 3$ — turned italic in the hover preview of a tab. They expected it to look "like the note in the main viewer."17 A member of the Obsidian team replied: "it’s not a bug. Dollar sign is the beginning of an inline math block. You should escape it \$."

Older reports point at other surfaces. A 2021 thread found prices styled in edit mode while "Preview mode is styled correctly."18 Its author added: "Since the number of people who will use dollar signs to mean dollar signs is probably much higher than those who will use LaTeX this seems a bit backwards."

A 2026 thread titled "Trying to type a simple dollar sign" ended with the cause: "a plugin I’d forgotten about, called ‘Text Color Tags’."19 We did not run Obsidian. In Obsidian, the editor and previews have flagged prices that reading view left alone — test both views, with your plugins on.

Cursor. A March 2026 bug report said the assistant's chat renderer "interprets pairs of $ characters as LaTeX inline math boundaries."20 Cursor staff answered: "This is a known issue with markdown rendering in chat," and later said "it started after a recent update that changed how the chat panel renders markdown." The interim advice was to ask the model to "avoid using bare $ signs, write ‘USD’ instead".

On 7 April 2026 a staff member posted: "The markdown rendering issue where dollar signs were parsed as LaTeX has been addressed in a recent Cursor update."20 A chat window prints prices constantly. It shipped permissive dollars anyway, then fixed them.

Flowershow. Its 17 August 2026 changelog opens: "Text that mentioned two dollar amounts used to break silently."21 The new rule: "A $…$ is only treated as math when there's no space right after the opening $ and no space right before the closing $." That is the spacing rule without pandoc's digit clause — the one that let $5-$10 through in arithmatex. We did not test Flowershow itself.

Common mistakes

Most failures come from trusting the wrong test. A price that rendered fine alone, a span tag copied from GitHub's docs, a check run in one view only — each passes once and fails in the next app. Each mistake below showed up in our receipt, and each has a one-step fix.

Frequently Asked Questions

Write two prices in a note and the words between them can turn into math. These are the questions people type when that happens, taken from Stack Overflow and the Obsidian and Cursor forums with titles kept as asked. Where an app was not tested here, the answer says so and gives the method that held everywhere we tested.

Why do dollar signs disappear in Markdown?

A math extension is reading them as inline-math delimiters. It removes both signs and renders the text between them as an equation. Careful engines, like pandoc, ignore dollars with a space inside or a digit after the closing sign. Permissive ones pair any two. Write \$ before each price to keep the sign.

Escaping dollar sign in ipython notebook

Put a backslash before the dollar sign: \$5. We did not test Jupyter's renderer for this piece. In every math-enabled Markdown engine we did test, \$ displayed as a plain dollar sign and never opened math. If a backslash shows up on screen instead, the renderer lacks a math extension and uses the older escape list.

How can I use dollar signs ($) in a Markdown code block in a way that renders correctly when converted to HTML?

Inside a code span or fenced code block, write the dollar sign bare. Code spans such as `$5` stayed plain text in all 15 configurations we tested, math extensions included. Do not add a backslash there: inside code, the backslash is printed literally, as GitHub's renderer showed with \$99.

Trying to type a simple dollar sign

In a note with math turned on, a lone dollar sign is fine; two on one line can pair into math. Type \$ for each price. If that fails in Obsidian, check community plugins: one 2026 forum thread traced the problem to a plugin called Text Color Tags, not to Obsidian itself.

Dollar signs lead to italic in tab preview

The italic text is the words between two dollar signs rendered as math. Obsidian's team answered this 2026 report by saying it is not a bug and recommending \$. The reporter's main view looked fine, so different surfaces can disagree. Escape the prices and recheck every view you use.

Provide a toggle to allow $ symbols to be treated as text

We found no built-in Obsidian setting for this in what we read, so we will not promise one. Escaping with \$ works without any setting. If you run your own site, parser options do exist: micromark-extension-math has singleDollarTextMath: false, and mdit-py-plugins' dollarmath accepts allow_space=False, allow_digits=False.

Currency dollar signs ($) in assistant responses are parsed as LaTeX inline math delimiters

That was Cursor's chat renderer in March 2026. Cursor staff called it a known rendering regression, then said on 7 April 2026 that a recent update addressed it. Updating fixes that case. Cursor's interim advice still applies to other chat tools: ask the model to escape dollar signs or to write USD.


A dollar sign in a note means money until a parser decides otherwise. One backslash keeps the decision yours.


MNMNOTE keeps your notes as open Markdown on your own device — so the \$12 you write today is the same text every renderer in the table above will read. mnmnote.com

Footnotes

  1. micromark-extension-math, README, §Options, singleDollarTextMath. https://github.com/micromark/micromark-extension-math#options, accessed 2026-11-15. ↩ ↩2 ↩3

  2. Own receipt, 2026-11-15: 21 one-line cases (8 price lines, the escaped line, a $x^2$ control, 8 mixed price-and-math lines, code spans, and two vendor example sentences) rendered through 15 configurations — markdown-it 15.0.3 with markdown-it-texmath 1.0.0, @vscode/markdown-it-katex 1.1.2 and markdown-it-katex 2.0.3; micromark 4.0.3 + micromark-extension-math 3.1.0 (default and singleDollarTextMath: false); marked 18.2.0 + marked-katex-extension 5.1.13 (default and nonStandard: true); Python-Markdown 3.11.3 + pymdown-extensions 13.1 arithmatex (default and smart_dollar: False); markdown-it-py 4.3.0 + mdit-py-plugins 0.7.0 dollarmath (default and allow_space=False, allow_digits=False); pandoc 3.13 (-f markdown, gfm, commonmark_x); GitHub REST API POST /markdown (gfm). KaTeX 0.18.10, Node 20.20.2, Python 3.14.4. ↩ ↩2 ↩3 ↩4

  3. Stack Exchange API 2.3, question 16089089, "Escaping dollar sign in ipython notebook" (asked 2013-04-18; 58,914 views, score 72). https://api.stackexchange.com/2.3/questions/16089089?site=stackoverflow, accessed 2026-11-15. ↩

  4. John MacFarlane, Pandoc User's Guide (pandoc 3.13), §Extension: tex_math_dollars. https://pandoc.org/MANUAL.html#extension-tex_math_dollars, accessed 2026-11-15. ↩

  5. PyMdown Extensions documentation, "Arithmatex," §Input Format. https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/, accessed 2026-11-15. ↩

  6. UziTech, marked-katex-extension, README, nonStandard option. https://github.com/UziTech/marked-katex-extension, accessed 2026-11-15. ↩

  7. mdit-py-plugins 0.7.0, mdit_py_plugins/dollarmath/index.py, dollarmath_plugin signature (allow_space: bool = True, allow_digits: bool = True), read from the installed package, 2026-11-15. https://github.com/executablebooks/mdit-py-plugins ↩

  8. npm registry downloads API, last-week point counts for 2026-11-07 to 2026-11-13: micromark-extension-math 18,279,323; remark-math 13,207,912. https://api.npmjs.org/downloads/point/last-week/micromark-extension-math, accessed 2026-11-15. ↩

  9. Own receipt, 2026-11-15, mixed lines across the 14 math-on configurations of note 1: It costs $5 and the area is $x^2$ here. (damaged in 6), the same with \$5 (only x^2 math in 14), and The area is $x^2$ and it costs $5. (only x^2 math in 14). ↩ ↩2 ↩3

  10. Own reading of installed source, 2026-11-15: markdown-it-texmath 1.0.0 texmath.js line 344, inline pattern /\$((?:[^\s\\])|(?:\S.*?[^\s\\]))\$/; marked-katex-extension 5.1.13 lib/index.cjs line 5, default inlineRule with a lookahead only after the closing delimiter. ↩

  11. Own receipt, 2026-11-15: It cost \$5 and then \$10. rendered as text in all 15 configurations and displayed as $5 in all 14 math-on ones; Python-Markdown 3.11.3 with no extension and pandoc 3.13 -f markdown_strict displayed \$5; Python-Markdown with arithmatex displayed $5. ↩ ↩2

  12. tf2, reply in "Provide a toggle to allow $ symbols to be treated as text," Obsidian Forum, topic 18781, 2021-05-25. https://forum.obsidian.md/t/provide-a-toggle-to-allow-symbols-to-be-treated-as-text/18781, accessed 2026-11-15. ↩

  13. Own receipt, 2026-11-15: It cost `$5` and then `$10`. stayed text in all 15 configurations. ↩

  14. GitHub Docs, "Writing mathematical expressions," §Writing dollar signs in line with and within mathematical expressions. https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions, accessed 2026-11-15. ↩

  15. Own receipt, 2026-11-15: To split <span>$</span>100 in half, we calculate $100/2$ (GitHub Docs' example), the same with \$100 and with bare $100, across the 14 math-on configurations of note 1. Span and bare forms failed in the same 6; the backslash form worked in 14. ↩ ↩2

  16. Own receipt, 2026-11-15: a seven-line sample note escaped with the perl command in step 3, rendered through the 11 JavaScript and Python configurations of note 1 and GitHub's POST /markdown (gfm). Prices stayed text everywhere; only $x^2$ was math; GitHub printed the code span as \$99. ↩

  17. Thomas4 (report) and WhiteNoise, Obsidian Team (reply), "Dollar signs lead to italic in tab preview," Obsidian Forum, topic 112506, 2026-03-20. https://forum.obsidian.md/t/dollar-signs-lead-to-italic-in-tab-preview/112506, accessed 2026-11-15. ↩

  18. davecan, "Using multiple dollar signs in edit mode results in MathJax styling inappropriately," Obsidian Forum, topic 15895, 2021-04-04. https://forum.obsidian.md/t/using-multiple-dollar-signs-in-edit-mode-results-in-mathjax-styling-inappropriately/15895, accessed 2026-11-15. ↩

  19. breathe67, "Trying to type a simple dollar sign," Obsidian Forum, topic 116961, 2026-08-05. https://forum.obsidian.md/t/trying-to-type-a-simple-dollar-sign/116961, accessed 2026-11-15. ↩

  20. Rocky_Medure (report, 2026-03-11), deanrie and mohitjain, Cursor staff (replies, 2026-03-12, 2026-03-16 and 2026-04-07), "Currency dollar signs ($) in assistant responses are parsed as LaTeX inline math delimiters," Cursor Community Forum, topic 154509. https://forum.cursor.com/t/currency-dollar-signs-in-assistant-responses-are-parsed-as-latex-inline-math-delimiters/154509, accessed 2026-11-15. ↩ ↩2

  21. Ola Rubaj, "Dollar amounts in prose no longer break your text," Flowershow changelog, 2026-08-17. https://flowershow.app/changelog/2026-08-17-currency-in-prose, accessed 2026-11-15. ↩