10

When asking a question, the "How to Format" information says:

► _italic_ or **bold**

suggesting using underscores to italicize a word.

Yet if one selects a word and clicks on the "I" in the editing menu, the result is:

*italic*

using asterisks instead of underscores.

Is one method preferred over the other, and why are the "How to" and the "I" different?


Laurel points out that it's even more complicated than simply have two different ways of indicating the same thing.

b**ol**d produces "bold", as expected, while b__ol__d produces "b__ol__d", with the embedded underscores having no special meaning.

Since the two characters have different effects, it is even more confusing than I had originally thought for the button and the How-to to not use the same character.

I'd suggest that the asterisk should be the officially preferred character in all documentation and examples, with the underscore mentioned as also being allowed, with a warning that it doesn't work in some circumstances.

8

They are not entirely equivalent; I prefer asterisks because you can use them to emphasize part of a word:

Italics
_it_alics

Markdown:

*It*alics
_it_alics
1

There is no preference; they are equivalent.

Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML <em> tag (italics); double *’s or _’s will be wrapped with an HTML <strong> tag (bold).

This is per the CommonMark Spec.

  • 5
    I understand how it works. I just find it confusing that on the same page, the "How to" suggests one style and the button produces the other style. My anal retentive mind prefers consistency. It would be better if one method were chosen as the standard method, with the other as an alternative. Which is which doesn't matter. One can say "Mr." or "Mister" and either way is correct, but mixing them in the same context is wrong. – Ray Butterworth Sep 3 at 19:01
  • 1
    @RayButterworth Mixing them was a simple way to emphasize that both _ and * are valid options for bold and italic, without being overly wordy about it. That is a tiny box shoved to the side after all. – animuson Sep 3 at 21:59
  • 3
    @animuson, As Laurel points out, they are not equivalent. – Ray Butterworth Sep 4 at 1:35

You must log in to answer this question.

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