How to format a text containing underscore (like for instance "A_B") to italic style ?
Here's an example which fails in parsing somehow (from a quick test just on underscore):



2 Answers 2


Use a HTML tag (<i>),


produces A_B. The underscore makes Markdown fail to interpret the markup as intended.


I have changed (almost rewritten) the Markdown regular expressions for bold and italics: client-side change, server-side change. These will be in the next build.

They fix various issues, the major ones being:

  1. Asterisks and underscores don't interfere with each other anymore. In particular, your *A_B* will look as expected.

  2. Intra-word emphasis is really disabled. Asterisks and underscores are not supposed to have any effect when they appear inside words, but in cases like foo__bar__baz and 2**5 + 4**3 they still did.

  3. ***text*** now renders as <strong><em>text</em></strong>, not incorrectly nested as <em><strong>text</em></strong>. This wasn't usually a user-visible problem (the browsers handle it fine), but could cause some weird-looking revision diffs, for example.

I have tested this change on 50,000 Meta posts (where every Markdown edge case that exists is exploited somewhere, so it's a good test bed). The only place where this made a difference that wasn't clearly positive was this question, where the italicized footnote was created with **We would...*. The fact that this used to work was more an accident.

All other locations where I found a difference caused by this change are a definite improvement.

This already worked correctly in comments.

  • 1
    Is this why URLs now have _ percent encoded? If that's a new change (the non-reserved _ character being encoded to %5f) then that change broke Github links at least. Apr 14, 2014 at 13:53
  • 1
    @MartijnPieters No, this is why.
    – balpha Staff
    Apr 14, 2014 at 13:57

You must log in to answer this question.

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