Markdown has the same class of issue and resolves it the same way you would with Typst: The escape character \. You instead write saved \$50 million using C\#.
I never understood why markdown authors are so insistent on using a single $ to denote math. Math is outside the commonmark spec so this is entirely up to plugin authors.
I am an author of a fairly popular (and early) math plugin for markdown and I resisted (albeit not very hard). I made $$ the default delimiter but I noticed very soon that my users hated it, and finally I gave up and made $ the default delimiter.
What I would have preferred is for $ to behave exactly like backticks (except a minimum of two to start inline math) So you could do stuff like $$ f $ x $$ to render f $ x meaning function f applied with x. And write stuff like:
$$$optional-tag
f $ x
$$$
for block math. I even wrote a competing plugin to my older one where I do this, but I don‘t think anybody uses is, because most people writing math in markdown are expecting it to behave exactly like latex.
I don’t really like that either since code blocks are supposed to be verbatim, and the language is only supposed to be a hint for syntax highlighting. Additionally you also occupy the first tag which may be an issue when e.g. writing a preample for a latex renderer (or if you want to pick a different renderer).
I am an author of a fairly popular (and early) math plugin for markdown and I resisted (albeit not very hard). I made $$ the default delimiter but I noticed very soon that my users hated it, and finally I gave up and made $ the default delimiter.
What I would have preferred is for $ to behave exactly like backticks (except a minimum of two to start inline math) So you could do stuff like $$ f $ x $$ to render f $ x meaning function f applied with x. And write stuff like:
for block math. I even wrote a competing plugin to my older one where I do this, but I don‘t think anybody uses is, because most people writing math in markdown are expecting it to behave exactly like latex.