Seems like there is a bug, that breaks my indentation.


  1. In third code section of Create New C++ Class

  2. In first code section of Code Generator Generator

    enter image description here

  3. multiple times in the code section of https://codereview.stackexchange.com/a/84104/ (Perl syntax naturally includes both \$ and $$).

This occurs on both block delimiters and inline delimiters. Live minimal test case:




In the Markdown source, all lines are vertically aligned, not additionally indented

  • 2
    \$\begingroup\$ Hmmm... I can reproduce it, and do not understand why it is broken..... \$\endgroup\$
    – rolfl
    Feb 15, 2015 at 15:07
  • 2
    \$\begingroup\$ Yikes, creepy.... \$\endgroup\$
    – janos
    Feb 15, 2015 at 15:33
  • \$\begingroup\$ reproduced on our dev environment, it's mathjax related, happens when we're baking a post's markdown to html, looking into it \$\endgroup\$
    – m0sa
    Feb 16, 2015 at 15:49
  • 3
    \$\begingroup\$ @m0sa has there been any progress on this problem? I was baffled why my code – even in the editor preview – had this random extra indentation. That kind of sucks for a site that's about clean code, which involves proper formatting. \$\endgroup\$
    – amon
    Mar 16, 2015 at 8:07
  • \$\begingroup\$ @amon I looked into it, turned out to be a deep rabbit hole requiring at major refactoring of MarkdownSharp (we'd need to make the pipeline extensible, so we could inject stuff before DoCodeBlocks in RunBlockGamut - currently all the processing happens before we ever hit MarkdownSharp, but we'd need to leverage it's block processing) \$\endgroup\$
    – m0sa
    Mar 16, 2015 at 11:49
  • 2
    \$\begingroup\$ Similar issue from PPCG. /cc @m0sa \$\endgroup\$
    – Doorknob
    Apr 8, 2015 at 21:00

1 Answer 1


This seems to happen because of the above line having two $ in a row.

static std::string TOKEN_LINEDUMP("$$
    static std::string TOKEN_INDENTNEXT("$$>");

Removing the second $ on the first line causes it to be shown normal:

static std::string TOKEN_LINEDUMP("$
static std::string TOKEN_INDENTNEXT("$$>");

Further investigation is needed.

  • 5
    \$\begingroup\$ is this related to mathjax?? \$\endgroup\$
    – Vogel612
    Feb 15, 2015 at 15:50
  • 1
    \$\begingroup\$ Actually, removing any of the $ will stop the indentation. This does make it look like a MathJax issue. \$\endgroup\$
    – Jamal
    Feb 16, 2015 at 1:40
  • 1
    \$\begingroup\$ FYI, this is not due to MathJax itself since MathJax stops parsing at HTML elements, so it won't touch <span class="str">"$$&gt;"</span> etc. However, it could have something to do with the way StackExchange's editor isolates LaTeX-input from the Markdown processor. \$\endgroup\$ Feb 17, 2015 at 13:25
  • \$\begingroup\$ Could we not have some <!-- mathjax:off --> magic comment to switch off MathJax on top of a code block? \$\endgroup\$ Oct 17, 2015 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .