What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

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*

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Use a HTML tag (<i>),

<i>**A_B**</i>

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

share|improve this answer

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.

share|improve this answer
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. –  Martijn Pieters Apr 14 at 13:53
1  
@MartijnPieters No, this is why. –  balpha Apr 14 at 13:57

You must log in to answer this question.

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