5

Possible Duplicate:
Markdown handles inline bold text (within a word) incorrectly

See here:

If I want to write Hello but only bold the H I can try:

Hello

Well that is weird....
What I typed was **H**ello. That should have worked.

It does work when I use a UTF-8 Hack however:

H​ello

Looks the same: **H**​ello but somehow it shows differently.

What I am using is called a ZERO WIDTH SPACE. The problem is, why do I have to go through so much trouble just to make one letter in a word bold?

This affects times where people have to make answers like over here. Where the OP is trying to emphasize certain beginning of words.

Can this be fixed? As shown it is as easy as a UTF-8 Hack in the markdown.

8
  • @YiJiang'sProble_ yes, but i am proposing a solution.
    – Naftali
    Dec 23, 2011 at 15:12
  • 1
    As it is possible to escape the asterisk, who wants to write **He**llo could still do it by writing \*\*H\*\*ello. I don't see in which cases highlighting the first letter would be done when the user doesn't want that.
    – apaderno
    Dec 23, 2011 at 15:13
  • 1
    @kiamlaluno i dont want to write **H**ello
    – Naftali
    Dec 23, 2011 at 15:14
  • 1
    I understood that; I am just saying that who wants to write **H**ello could still do it. My comment was also to say that I doubt we would have users asking why they get a bold H when they wanted to write **H**ello.
    – apaderno
    Dec 23, 2011 at 15:18
  • 1
    @kiamlaluno ha, that is true ^_^
    – Naftali
    Dec 23, 2011 at 15:18
  • 3
    As an aside, the "official" Markdown claims: "Emphasis can be used in the middle of a word: un*frigging*believable"
    – Arjan
    Dec 23, 2011 at 15:23
  • 3
    Did you really just post two consecutive duplicate posts on the same topic? LEARN 2 <b>!
    – Shog9
    Dec 23, 2011 at 18:52
  • 1
    @Jeff -- how is that not a bug?
    – Naftali
    Dec 25, 2011 at 13:56

2 Answers 2

13

The problem is, why do I have to go through so much trouble just to make one letter in a word bold?

Because the StrictBoldItalic setting is set to true in Stack Exchange's Markdown parser, an intentional deviation from the Markdown specification. This is very much , presumably stemming from concerns about the characters used to indicate bold and emphasis (particularly underscores) being misinterpreted in the post.

Note that this has since been improved to allow for the use of asterisks (but not underscores, for the reasons mentioned above) for intra-word emphasis, so your mentioned use case will now work in posts/edits going forward, as well as comments.

14
  • As stated on the other answer. Why does it allow for italics then?
    – Naftali
    Dec 23, 2011 at 15:26
  • 1
    Odd, @amanaPlanaCAnalPAnaMA. But I doubt it's allowing italics, but it's merely failing? Just *E*mphasis does not work either.
    – Arjan
    Dec 23, 2011 at 15:30
  • Because you've included the pair of asterisks, you've created a non-word boundary that the regular expression considers valid for the purposes of strict italics.
    – Tim Stone
    Dec 23, 2011 at 15:30
  • @Arjan see the OP. the *H* is italics
    – Naftali
    Dec 23, 2011 at 15:31
  • @TimStone is that why the ZERO WIDTH SPACE works then?
    – Naftali
    Dec 23, 2011 at 15:31
  • @amanaPlanaCAnalPAnaMA Actually, the H is in italics, the non-word asterisks are outside of the italics (which is why it happens).
    – Tim Stone
    Dec 23, 2011 at 15:32
  • @amanaPlanaCAnalPAnaMA A zero-width space is a non-word character.
    – Tim Stone
    Dec 23, 2011 at 15:32
  • @amanaPlanaCAnalPAnaMA - because ZERO WIDTH SPACE is treated as a word boundary. It is a space after all.
    – ChrisF Mod
    Dec 23, 2011 at 15:33
  • @Scrooge I guess... but with zero-width lol
    – Naftali
    Dec 23, 2011 at 15:33
  • I know, @aman, but I feel it's wrongly taking a single asterisk from the two you typed (rather than taking just one on purpose). When you just type one, the parser is ignoring it too.
    – Arjan
    Dec 23, 2011 at 15:33
  • @Arjan Exactly. The problem of course is that the parser can't know your intentions, so when bold doesn't succeed it just blissfully moves on to try italics, which circumstantially work.
    – Tim Stone
    Dec 23, 2011 at 15:38
  • @Arjan and the spin off: meta.stackexchange.com/q/116990/155556 ...
    – Naftali
    Dec 23, 2011 at 15:39
  • @AMan​AboutAPlanInPanama, zero width space also work as a boundary in, for example, @mentions... ;-) (What, only now, while starting to type it backwards after the first @amanU+200B, I realized it's a palindrome!)
    – Arjan
    Dec 23, 2011 at 15:45
  • 1
    @Arjan hehe why yes I am a palindrome ^_^ ‮
    – Naftali
    Dec 23, 2011 at 15:47
7

The characters used for formatting are also often used in their "normal" meaning, for example in "2*6 = 3*4" or "some_variable_name". You end up with a lot of unintended formatting if you don't restrict where those characters have special meaning.

If you want an easy way to format part of a word, you can use the according HTML tags, like <b>H</b>ello.

5
  • Then why would the text become italics. your theory makes no sense....
    – Naftali
    Dec 23, 2011 at 15:25
  • 2
    @aman: That looks like a bug.
    – sth
    Dec 23, 2011 at 15:33
  • Primo, such cases would be rare, and escaping would be there for them. Jan 3, 2014 at 9:21
  • Secundo, <b>H</b>ello does not work in comments, neither <strong>B</strong>onjour, neither Good <i>b</i>ye, neither <em>T</em>schüß. Which is a shame. Jan 3, 2014 at 9:28
  • Tertio, in answers the equivalent HTML for Hello is <strong>H</strong>Hello, not <b>H</b>ello. Jan 3, 2014 at 9:30

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