Skip to content

Instantly share code, notes, and snippets.

@d-rome
Created July 26, 2011 05:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-rome/1106073 to your computer and use it in GitHub Desktop.
Save d-rome/1106073 to your computer and use it in GitHub Desktop.
Condensed compilation of Markdown features

Introduction to Markdown

This is an example of the markdown language as displayed by github. For the best results, compare this markdown to the raw text side by side. The information is primarily from Daring Fireball, but condensed into one big example with commentary limited to gotchas. This line will continue the previous paragraph.
Two spaces at the end of the line denotes a new line.

An empty line adds an empty line in addition to denoting a new line. This behavior is the same with or without spaces.

word_with_underscores_stays_the_same
italicized word
bolded word
italicized & bolded word

Eating babies is a modest proposition.

Quotations are easy enough as long as you remember to new line around them.

99.9% of the time these characters display normally:
\ backslash
` backtick

  • asterisk
    _ underscore
    {} curly braces
    [] square brackets
    () parentheses
    . dot
    ! exclamation mark
    < less than (unless in a tag)

greater than (unless in a tag)

These characters need to be escaped at the beginning of a sentence:
# hash mark
+ plus sign
- minus sign (hyphen)
But they work fine if + used - in a # sentence.

HTML in Markdown

Markdown doesn't restrict your use of special characters very much. One exception is HTML tags. This custom HTML tag won't be visible in the markup. If casually referencing a <html> tag, it's easiest to put them in code blocks.

On the flip side, you can use many tags as if you were writing regular old html markup. Perhaps the most useful is creating a table on the fly.

How about some data?
Key Value
The meaning of life 42

Links

Absolute inline links: http://example.com/ or with an alias.
Here's a relative path link to a local resource.
Reference-style links**1** are reusable 1,2 through a hidden bibliography.

Two ways to link Images:

broken image broken image

These three headers

automatically add

a dividing line.

Other headers

github provides
do not.

A


divider


or two.

Lists

  1. Paragraphs also can be bulleted or numbered.

  2. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

    This is the second paragraph in the list item. You're only required to indent the first line. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ullamcorper pulvinar augue, ac interdum sem dignissim a. In blandit enim ut erat consectetur nec laoreet nunc sollicitudin.

  • these three characters
  • constitute list items
  • even if they are not numbers
  1. or even numbered correctly.

Text breaks the list.

  • it's just

  • one list item

  • after

    This is a blockquote inside a list item.

  • another

Code

It's easiest to format short commands or <html> tags within a sentence.

# Full code blocks are triggered with a newline and 4 space indent.
sudo apt-get install mysql-query-browser
# Alternatively, the language can be chosen to get rich markup.
def say_stuff
  3.times do
    puts "stuff"
  end
end

Conclusion

My hope in making this gist was to absorb some features of markdown I don't regularly use. If you have any functional features to add, let me know and I'll add them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment