Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

What are the complete syntax rules for emphasis?

Solved! Go to Solution.

Can someone point me to all the rules about bold and italic text in GitHub Flavored Markdown? I already found two surprises:

  • An underscore after a letter doesn't begin italic text. Try _italic_ but_not italic_
  • An asterisk after a letter and before a parenthesis doesn't begin italic text. Try regular*italic* but*(why not italic?)*
2 Replies
Community Manager
Message 2 of 3

Re: What are the complete syntax rules for emphasis?

Hi @italicize,

 

GitHub uses CommonMark as the Markdown processor, so you can view all of the rules for emphasis in the CommonMark specifications.

 

Does this help?

 

Thanks!

Solution
Copilot Lvl 2
Message 3 of 3

Re: What are the complete syntax rules for emphasis?

The complete specification has 17 rules about when emphasis begins and ends. To summarize, I wrote three rules for myself:

 

  1. Use either asterisks or underscores to emphasize a character next to a space, punctuation, or the beginning or end of a line. Put an emphasis mark immediately next to a character, with no space between.
    • Exception. Special punctuation marks override this rule, including a backslash, backtick, and square brackets which cause an asterisk or underscore to be rendered as a character and ignored as an emphasis mark.
  2. Use an asterisk to emphasize letters and numbers next to letters and numbers. By contrast, an underscore is not an emphasis mark between letters and numbers, as in not_italic.
  3. To emphasize punctuation next to letters and numbers, use HTML tags. By contrast, an asterisk and underscore cannot emphasize punctuation next to an unemphasized letter or number.

 

To see these rules with examples, see Emphasis in GitHub Flavored Markdown.