# Trapped in the code: spacing and punctuation next to dollar signs prevents ending paragraphs and environments

Here is a weird bug (or unexpected feature) in the MarkDown engines, probably tex related.

 ($\{a,b\}$) now you can never leave the code block.
Not on a new line.

Not in a new paragraph.

You are forever in the code block.

Until you say the magic word, open-parenthesis dollar-sign: ($ New line for a new world. New paragraph to celebrate the new me. • For low rep users, what I typed is available at meta.math.stackexchange.com/posts/2332/revisions and more directly at meta.math.stackexchange.com/revisions/… – Jack Schmidt Jun 9 '11 at 23:42 • – Jack Schmidt Jul 15 '11 at 17:07 • it may be a bug, but it is also one that it out of our control - it is a MathJax bug and not something we, at Stack Exchange can fix. (ed ajf) – Oded Jul 16 '14 at 10:05 • Actually the bug has been fixed already, as you can see if you click "edit" on the question and look at the preview. At some point StackExchange must have changed their Markdown-to-HTML converter to fix the problem, but IIRC the generated HTML is not updated for existing posts, like this one, unless someone actually edits the content. So let's mark this [status-completed] and drop the matter. – Rahul Jul 16 '14 at 19:16 • @Rahul: That might be, but the truth is that the preview render code is different from the final render code. So it might not be as solved as you might think. – Asaf Karagila Jul 16 '14 at 21:11 ## 2 Answers A few observations: ($ \{a,b\} is completely optional and has nothing to do with what you observe, so here's a smaller example

 $now you can never leave the code block. Not on a new line. Not in a new paragraph. You are forever in the code block. Until you say the magic word: dollar sign.$


Similarly,

( again you can't leave the code block.

Not on a new line.

Not in a new paragraph.

You are forever in the code block.

$on we go until we don't know what nonsensical stuff to write and hit enter  and that brings us out. The first dollar sign seems to be ignored by the engine due to the parenthesis right before it while the second opens a block which is then closed by the last dollar sign. It doesn't seem to work with the back-ticked code blocks. The block quote environment:$ in a block quote we (new line) we have a similar thing: new lines and new paragraphs are ignored.$and out we go ($ $just another test new line new paragraph$ and

out we are.

Looks like it's been fixed already. Here's exactly the same Markdown code from the question, copy-pasted into a new answer for Asaf's benefit:

Here is a weird bug (or unexpected feature) in the MarkDown engines, probably tex related.

 ($\{a,b\}$) now you can never leave the code block.


Not on a new line.

Not in a new paragraph.

You are forever in the code block.

Until you say the magic word, open-parenthesis dollar-sign: (\$ New line for a new world.

New paragraph to celebrate the new me.

• So, are we friends with benefits now? :-P – Asaf Karagila Jul 16 '14 at 22:29