24

These two markdowns:

A Freudian slip is when you say _one thing_ but mean __your mother__
A Freudian slip is when you say *one thing* but mean **your mother**

Get marked down as equally:

A Freudian slip is when you say one thing but mean your mother

that is, both _one thing_ and *one thing* have the effect of italic. And both __your mother__ and **your mother** make the text bold.

Is there any historical/specific reason why both italics and bold have two different, synonymous, syntaxes? I could not find any other case when this happens.

The official page for Markdown states in its section Syntax:

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

And then:

EMPHASIS
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis
(...)
You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

But it does mention why _ was introduced to mimic the usage of *.

6
  • I seem to remember John Gruber (the creator of Markdown) explaining this somewhere, but it was years ago. I didn't find it in a quick search of his site (daringfireball.net), but perhaps you could find something searching the archives of the old Markdown-Discuss mailing list
    – Waylan
    Aug 24, 2016 at 14:28
  • @Waylan oh nice! In daringfireball.net I just found the parts I quoted in the question. I did a fast search on google for site:pairlist6.pair.net underscore asterisk and could not find anything relevant, neither in symbolhound.com. I will keep digging, though, thanks a lot for the hint!
    – fedorqui
    Aug 24, 2016 at 14:35
  • @Waylan in fact I just found this thread where Gruber says: Asterisks were never in doubt. Underscores were added as a secondary syntax because enough people seemed to use them in email.
    – fedorqui
    Aug 24, 2016 at 14:41
  • After I posted my comment, I noticed the list archives only go back to 2006. I'm pretty sure the list went back further than that. Sorry, I don't know where the older archives would be.
    – Waylan
    Aug 24, 2016 at 14:41
  • @Waylan It seems like older conversations are still archived on pairlist6, but not displayed in the list you linked. I found this email response, is that the one you were referring to? I added an answer with it below. Sep 5, 2017 at 17:34

3 Answers 3

16

Via the link fedorqui posted in his second comment, there is another link to an old email reply where Gruber motivates his choice of giving both _ and * equivalent functionality.

One of the key points is that he uses his own email conversations to conclude that rather than thinking of it in italics and bold font, people generally use either single wrapping underscores or asterisks to emphasize (<em>) a word, while they tend to use double wrapping underscores or asterisks to strongly emphasize (<strong>) a word. He uses a single * for <em> himself.

There seems to be some issues with rendering html tags in the first version I read but I found a seemingly complete archived version elsewhere. I have pasted the content below, only adding backticks to avoid SO formatting the asterisks and underscores:

John Gruber gruber at fedora.net Mon Mar 15 21:11:34 EST 2004

Previous message: asterisks as bold or italic?
Next message: asterisks as bold or italic?
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Merlin Mann wrote on 03/15/04 at 8:10p:

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

It's probably late in the game for a syntax suggestion, but I'm having a hard time getting used to *foo* making text <em> instead of <strong>.

It is late in the game for a change like this, but, trust me, even if would have had the opportunity to make this case months ago, you wouldn't have succeeded.

It's not that I think you're *wrong*, per se. But the very first feature in Markdown -- before it could even wrap <p> tags around paragraphs, even -- was a regex pattern that turned:

*this*

into:

<em>this</em>

In short, you're sort of screwed, because that's how I write, and it's how I've written since around 1992.

I wonder if my experience is unique, but I've always seen and used asterisks to make something bold while wrapping with the space/underscore would style text as italic. This goes for wikis I've used as well as text mail from my provider (http://www.fastmail.fm) (among others, I'm pretty sure).

It wasn't just based on my personal whim. If you look around, you can find support for both ways of interpretting single asterisks (em vs. strong). Textile agree with you, for example.

reStructuredText, however, agrees with me:

http://docutils.sourceforge.net/docs/rst/quickstart.html#text-styles

The actual spec for Setext says that **double** asterisks are equivalent to strong emphasis, but uses ~tildas~ for italics. (But neither of the two Setext-formatted newsletters I read, TidBITS and MDJ, use tildas for emphasis.)

I also searched through an awful lot of my email, and what I found is that both _underscores_ and *asterisks* are in wide use, but both styles tend to be used to imply normal word emphasis. E.g., if you stop thinking about "italics" and "bold", and think instead of "emphasis" and "strong emphasis", I think it's very fair to say that _this_ and *this* both imply normal emphasis.

It would certainly be faster and less-error-prone to type a single character in each case, plus it might open up the double characters for use as "-like" escape characters in the future.

I can see the case for ** and __ being somewhat reasonable escape sequences to generate single-literal characters, but I'm not the least bit persuaded by the idea that it's faster to type *this* instead of **this**.

If it's just my own peculiar habit, I can certainly un-learn it, but I'm curious if anyone else had this experience when using Markdown.

I'll emphasize that I don't think there's anything peculiar about your habit; and I'm sure others share it. And I sympathize with the fact that my decision has broken your habit. But I'm also sure that there are others whose habits match mine.

Now, of course, the other route would be to make these emphasis sequences configurable. Or, at least, to offer a few preset variations on how to interpret them.

The advantage would be that most people could get Markdown to treat word emphasis exactly how they prefer. That'd be good.

The downside would be that Markdown's format would no longer be the same everywhere. If there's just once consistent style, Markdown should work exactly the same everywhere.

It's also the case that this would add an entire layer of complexity to the software.

Sorry to disappoint,

-J.G.

5
  • 2
    Thanks a lot for the thorough investigation! I see you started from a link in one of my comments, apparently I was almost there :)
    – fedorqui
    Sep 15, 2017 at 20:19
  • 3
    So the key here is if you stop thinking about "italics" and "bold", and think instead of "emphasis" and "strong emphasis", I think it's very fair to say that _this_ and *this* both imply normal emphasis.
    – fedorqui
    Sep 15, 2017 at 20:21
  • I'm working on a document where italics are applied to Genus and Family (for identifying bacteria) and this is really messing it up. Contextualizing is great (thinking of things as emphasis instead of bold), but sometimes it's just an italic, and not an emphasis
    – Jan
    Jun 27, 2018 at 19:58
  • Thanks for taking the time to dig this up! Oct 22, 2019 at 5:19
  • "In short, you're sort of screwed, because that's how I write, and it's how I've written since around 1992." That's the reason? Wow. Charming. :-\
    – Nyerguds
    Dec 2, 2022 at 14:22
8

One day after releasing Markdown, John Gruber posted a long explanation of his motivations for creating Markdown. He stated in part:

You don’t need to “preview” an email before you send it — you write it, you read it, you edit it, right there.

In fact, I love writing email. Email is my favorite writing medium. I’ve sent over 16,000 emails in the last five years. The conventions of plain text email allow me to express myself clearly and precisely, without ever getting in my way.

Thus, Markdown. Email-style writing for the web.

I can't find it now, but I recall him explaining elsewhere that this was a primary factor in the choices he made (see the other answer). Many of the syntax rules were derived from the way people were already using plain text to author emails. For example, (as the OP found and noted in a comment) he stated many years later:

Asterisks were never in doubt. Underscores were added as a secondary syntax because enough people seemed to use them in email.

As I recall, the same was true of asterisks. Many people were already using them in email.

3
  • OK so this also matches with what was used in Usenet. I also recall some texts on UNIX systems using asterisks for emphasis, but not underscores. This being said, it looks like John Gruber just wanted to make it easier for everyone, not to change the state of art. Using both syntaxes seems to be just a matter of replicating what was on place. To know the original reason we should dig a bit more then!
    – fedorqui
    Aug 24, 2016 at 15:05
  • Yeah, that is my understanding. Sounds like you got it. And I forgot about Usenet. That may be a helpful search term to dig up a more complete discussion about this.
    – Waylan
    Aug 24, 2016 at 15:11
  • Yes. Relevant links (for future reference): ” and “*” being synonymous is redundant and confusing: _In short, you're sort of screwed, because that's how I write, and it's how I've written since around 1992. Underscore When the underscore is used for emphasis in this fashion, it is usually interpreted as indicating that the enclosed text is underlined (as opposed to being italicized or bold, which is indicated by /slashes/ or *asterisks*, respectively).
    – fedorqui
    Aug 24, 2016 at 15:19
7

There's one important difference between asterisks and underscores: Only asterisks can be used in words, i.e.

a*b*c

abc

produces an italic b while

a_b_c

a_b_c

does not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.