In the docs, it is clearly explained that the opening $ for TeX math must be followed by a non-space character, and the closing $ must be preceded by a non-space character.
The amsmath package defines a \text macro that allows normal text, including $-delimited math, to be included within equations. So, for example,
yields

As might be expected from the description of Pandoc's dollar parsing, Pandoc won't parse this correctly. It might be useful to mention explicitly in the docs that Pandoc isn't compatible with amsmath's \text macro, and that \mathrm can generally be used as a less powerful alternative. Or just mention explicitly that $ inside equations can cause things to break.
When the above code is sent through Pandoc in markdown mode, it returns the HTML
This is problematic because the subscript was completely eliminated--fragments don't even remain outside the math. Also, the final LaTeX is now invalid. It would be nice if the parsing failure could be more graceful.
In the docs, it is clearly explained that the opening
$for TeX math must be followed by a non-space character, and the closing$must be preceded by a non-space character.The
amsmathpackage defines a\textmacro that allows normal text, including$-delimited math, to be included within equations. So, for example,$a = b_\text{c $d$ e}$yields

As might be expected from the description of Pandoc's dollar parsing, Pandoc won't parse this correctly. It might be useful to mention explicitly in the docs that Pandoc isn't compatible with
amsmath's\textmacro, and that\mathrmcan generally be used as a less powerful alternative. Or just mention explicitly that$inside equations can cause things to break.When the above code is sent through Pandoc in markdown mode, it returns the HTML
This is problematic because the subscript was completely eliminated--fragments don't even remain outside the math. Also, the final LaTeX is now invalid. It would be nice if the parsing failure could be more graceful.