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):
A_B
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.
Sign up to join this communityUse a HTML tag (<i>
),
<i>**A_B**</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:
Asterisks and underscores don't interfere with each other anymore. In particular, your *A_B*
will look as expected.
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.
***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.
_
percent encoded? If that's a new change (the non-reserved _
character being encoded to %5f
) then that change broke Github links at least.
– Martijn Pieters
Apr 14 '14 at 13:53