In short, markdown data is converted to HTML data using the markdown processor which is in turn rendered by the browser. Markdown files have.md extension. In this article, we will walk you through the basic Markdown elements so that you can use them smoothly anywhere anytime. Markdown Cheat Sheet. My quick reference to the most commom MD. These examples are not pegged to Github markdown, instead I tried to cover what should be supported on all platforms. Block Elements Paragraphs & Breaks. To create a paragraph, simply create a block of text that is not separated by one or more blank lines. Blocks of text separated. 2 days ago Editor.md and Dillinger will let you see your Markdown rendered as HTML in real time. Dingus doesn’t preview in real time, but there is a Markdown syntax cheat sheet.
From adam-p/markdown-here
Table of Contents
Headers
Emphasis
Lists
Links
Images
Code and Syntax Highlighting
Tables
Blockquotes
Inline HTML
Horizontal Rule
Line Breaks
Youtube videos
Headers
H2
H3
H4
H5
H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H2
Emphasis
Emphasis, aka italics, with asterisks or underscores.
Strong emphasis, aka bold, with asterisks or underscores.
Combined emphasis with asterisks and underscores.
Strikethrough uses two tildes. Scratch this.
Lists
(In this example, leading and trailing spaces are shown with with dots: ⋅)
- First ordered list item
- Another item
- Unordered sub-list.
- Actual numbers don’t matter, just that it’s a number
- Ordered sub-list
And another item.
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we’ll use three here to also align the raw Markdown).
To have a line break without a paragraph, you will need to use two trailing spaces.
Note that this line is separate, but within the same paragraph.
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
- Unordered list can use asterisks
- Or minuses
- Or pluses
Links
There are two ways to create links.
Or leave it empty and use the link text itself.
URLs and URLs in angle brackets will automatically get turned into links.http://www.example.com or http://www.example.com and sometimesexample.com (but not on Github, for example).
Some text to show that the reference links can follow later.
Images
Here’s our logo (hover to see the title text):
Inline-style:
Reference-style:
Code and Syntax Highlighting
Code blocks are part of the Markdown spec, but syntax highlighting isn’t. However, many renderers – like Github’s and Markdown Here – support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the highlight.js demo page.
Inline code
has back-ticks around
it.
Blocks of code are either fenced by lines with three back-ticks ```
, or are indented with four spaces. I recommend only using the fenced code blocks – they’re easier and only they support syntax highlighting.
Tables
Tables aren’t part of the core Markdown spec, but they are part of GFM and Markdown Here supports them. They are an easy way of adding tables to your email – a task that would otherwise require copy-pasting from another application.
Colons can be used to align columns.
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
There must be at least 3 dashes separating each header cell. The outer pipes ( | ) are optional, and you don’t need to make the raw Markdown line up prettily. You can also use inline Markdown. |
Markdown | Less | Pretty |
---|---|---|
Still | renders | nicely |
1 | 2 | 3 |
Blockquotes
Blockquotes are very handy in email to emulate reply text.This line is part of the same quote.
Quote break.
This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can putMarkdown into a blockquote.
Inline HTML
You can also use raw HTML in your Markdown, and it’ll mostly work pretty well.
- Definition list
- Is something people use sometimes.
- Markdown in HTML
- Does *not* work **very** well. Use HTML tags.
Horizontal Rule
Three or more…
Hyphens
Asterisks
Underscores
Line Breaks
My basic recommendation for learning how line breaks work is to experiment and discover – hit <Enter> once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You’ll soon learn to get what you want. “Markdown Toggle” is your friend.
Here are some things to try out:
Here’s a line for us to start with.
This line is separated from the one above by two newlines, so it will be a separate paragraph.
This line is also begins a separate paragraph, but…
This line is only separated by a single newline, so it’s a separate line in the same paragraph.
(Technical note: Markdown Here uses GFM line breaks, so there’s no need to use MD’s two-space line breaks.)
Youtube videos
They can’t be added directly but you can add an image with a link to the video like this:
Or, in pure Markdown, but losing the image sizing and border:
Referencing a bug by #bugID in your git commit links it to the slip. For example #1.
License: CC-BY
My quick reference to the most commom MD. These examples are not pegged to Github markdown, instead I tried to cover what should be supported on all platforms.
Block Elements
Paragraphs & Breaks
To create a paragraph, simply create a block of text that is not separated by one or more blank lines. Blocks of text separated by one or more blank lines will be parsed as paragraphs.
If you want to create a line break, end a line with two or more spaces, then hit Return/Enter.
MD(dots are spaces in your MD):
Results:
This is a paragraph
This is just a continuing line of textThis is also just a continuing line of text
Headers
Markdown supports two header formats. The wiki editor uses the “atx’-style headers. Simply prefix your header text with the number of # characters to specify heading depth. For example: # H1, ## H2 and ### H3 will be progressively smaller headers, down to ###### H6.
MD:
Results:
H2
H3
H4
H5
H6
Blockquotes
Markdown creates blockquotes email-style by prefixing each line with the >. This looks best if you decide to hard-wrap text and prefix each line with a > character, but Markdown supports just putting > before your paragraph.
MD(dots are spaces in your MD):
Results:
This is a paragraph in a blockquote
This is just a lineI am also just a line
Lists
Markdown supports both ordered and unordered lists. To create an ordered list, simply prefix each line with a number (any number will do — this is why the editor only uses one number.) To create an unordered list, you can prefix each line with *, + or -.
MD:
Results:
- Apples
- Oranges
- Potatoes
- Carrots
List items can contain multiple paragraphs, however each paragraph must be indented by at least 4 spaces or a tab.
MD:
Results:
- Tree
- Apples
- Oranges
- Root
- Potatoes
- Carrots
Code Blocks
Markdown wraps code blocks in pre-formatted tags to preserve indentation in your code blocks. To create a code block, indent the entire block by at least 4 spaces or one tab. Markdown will strip the extra indentation you’ve added to the code block.
MD(dots are spaces in your MD):
Results:
Horizontal Rules
Horizontal rules are created by placing three or more hyphens, asterisks or underscores on a line by themselves. Spaces are allowed between the hyphens, asterisks or underscores.
MD:
Results:
Span Elements
Links
Markdown has two types of links: inline and reference. For both types of links, the text you want to display to the user is placed in square brackets. For example, if you want your link to display the text “GitHub”, you write [GitHub].
To create an inline link, create a set of parentheses immediately after the brackets and write your URL within the parentheses. (e.g., GitHub). Relative paths are allowed in inline links.
MD:
Results:
Emphasis
Asterisks (*) and underscores (_) are treated as emphasis and are wrapped with an tag, which usually displays as italics in most browsers. Double asterisks (**) or double underscores (__) are treated as bold using the tag. To create italic or bold text, simply wrap your words in single/double asterisks/underscores. For example, My double emphasis text becomes My double emphasis text, and My single emphasis text becomes My single emphasis text.
MD:
Results:
italicsstrongitalicsstrong
Code
To create inline spans of code, simply wrap the code in backticks (`). Markdown will turn myFunction
into myFunction.
MD:
Results:
ReactDOM.render(<Button />, document.getElementById('container'))
Images
Markdown image syntax looks a lot like the syntax for links; it is essentially the same syntax preceded by an exclamation point (!). For example, if you want to link to an image at https://github.com/unicorn.png with the alternate text My Unicorn, you would write ![My Unicorn](https://github.com/unicorn.png).
MD:
Results:
Miscallaneous
Automatic Links
If you want to create a link that displays the actual URL, markdown allows you to quickly wrap the URL in < and > to do so. For example, the link https://github.com/ is easily produced by writing <https://github.com/>.
MD:
Results:
Escaping
If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (). Markdown will ignore the character directly after a backslash.
MD:
Results:
Md Markdown Cheat Sheet
_italics_ _strong_