Skip to content

radiovisual/markdown-for-everyone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Markdown For Everyone

Markdown is an incredibly simple and hassle-free alternative to HTML. Markdown accomplishes the same thing as HTML, but Markdown uses a simple, easy-to-learn syntax that allows you to add a variety of styling options to your plain-text without all the hassle of opening and closing tags.

Use this cheatsheet as a way of demonstrating specific Markdown features. Because this document was written using Markdown, you can alternatively view this file's raw plaintext to see more of the specific markdown formatting used in this document.

Note: Markdown used on Github resources differs slightly in its feature set then Markdown used elsewhere, but once you learn the basics of Github-flavored Markdown, you are ready to write Markdown everywhere.


Table of Contents


Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading

Renders to:

h1 Heading

h2 Heading

h3 Heading

h4 Heading

h5 Heading
h6 Heading


Horizontal Rules

The HTML <hr> element is for creating a "thematic break" between paragraph-level elements. In markdown, you can create a <hr> with any of the following:

___: three consecutive underscores
---: three consecutive dashes
***: three consecutive asterisks

which renders to:






Body Copy

Body copy written as normal, plain text will be wrapped with paragraph tags <p></p> in the rendered HTML.

So this body copy:

Lorem ipsum dolor sit amet, graecis denique ei vel.

renders to this HTML:

<p>Lorem ipsum dolor sit amet, graecis denique ei vel.</p>


Linebreaks

To add a linebreak to your body copy, you need to put two spaces at the end of the text where you want the linebreak to occur.

So this body copy with two spaces at the end (spaces are being represented as 'βƒž'):

Putting two spaces at the end of this line βƒžβƒž
will cause this line to appear on the line below.  

renders to this HTML:

Putting two spaces at the end of this line <br/>will cause this line to appear on the line below. 

which will be seen in your markdown files as:

Putting two spaces at the end of this line
will cause this line to appear on the line below.

Note: This "two spaces" trick often trips up new users of Markdown, because spaces are invisible, so the rule is not obvious when reading Markdown files.

Note: If you want to add your own linebreaks without having to manage invisible space characters in your file, then you can simply add the <br /> tag wherever you want to add a linebreak, and your Markdown parser will honor it.



Emphasis

Bold

For emphasizing a snippet of text with a heavier font-weight.

To create bold text, use double underscores or double asterisks:

**rendered as bold text with double underscores**
**rendered as bold text with double asterisks**

which renders to:

rendered as bold text with double underscores
rendered as bold text with double asterisks

Italics

For emphasizing a snippet of text with italics.

The following snippets of text are rendered as italicized text by wrapping either single underscores or single asterisks:

_rendered as italicized text with underscores_
*rendered as italicized text with single asterisks*

which renders to:

rendered as italicized text with underscores
rendered as italicized text with single asterisks

Strikethrough

In Github-Flavored Markdown (GFM) you can do strikethroughs by wrapping the text with double tildes:

~~Strike through this text.~~

Which renders to:

Strike through this text.



Links

Basic link

[Assemble](http://assemble.io)

Renders to (hover over the link, there is no tooltip):

Assemble

HTML:

<a href="http://assemble.io">Assemble</a>

Add a Title

[Upstage](https://github.com/upstage/ "Visit Upstage!")

Renders to (hover over the link, there should be a tooltip):

Upstage

HTML:

<a href="https://github.com/upstage/" title="Visit Upstage!">Upstage</a>

Named Anchors

Named anchors enable you to jump to the specified anchor point on the same page. For example, each of these chapters:

# Table of Contents
  * [Chapter 1](#chapter-1)
  * [Chapter 2](#chapter-2)
  * [Chapter 3](#chapter-3)

will jump to these sections:

## Chapter 1 <a id="chapter-1"></a>
Content for chapter one.

## Chapter 2 <a id="chapter-2"></a>
Content for chapter one.

## Chapter 3 <a id="chapter-3"></a>
Content for chapter one.

NOTE that specific placement of the anchor tag seems to be arbitrary. They are placed inline here since it seems to be unobtrusive, and it works.



Blockquotes

For quoting blocks of content from another source within your document.

Add > before any text you want to quote.

Add `>` before any text you want to quote. 

Renders to:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

Nested Blockquotes

Blockquotes can be nested by using an incremental number of greater-than signs (>). For example, you will use one > for a blockquote at the first level. To nest a blockquote, simply use two >>, to nest a third blockquote, use three >>>, and so on.

Here is an example:

> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. 
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi. 
>> Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor 
odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
>>> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. 
Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi. 

Which renders to:

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.

Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.



Lists

Unordered

A list of items in which the order of the items does not explicitly matter.

You may use any of the following symbols to denote bullets for each list item:

* valid bullet
- valid bullet
+ valid bullet

For example

+ Lorem ipsum dolor sit amet
+ Consectetur adipiscing elit
+ Nulla volutpat aliquam velit
  - Phasellus iaculis neque
  - Purus sodales ultricies
+ Faucibus porta lacus fringilla vel

Renders to:

  • Lorem ipsum dolor sit amet
  • Consectetur adipiscing elit
  • Nulla volutpat aliquam velit
    • Phasellus iaculis neque
    • Purus sodales ultricies
  • Faucibus porta lacus fringilla vel

Ordered

A list of items in which the order of items does explicitly matter.

1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
4. Facilisis in pretium nisl aliquet

Renders to:

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Integer molestie lorem at massa
  4. Facilisis in pretium nisl aliquet

TIP: If you just use 1. for each number, GitHub will automatically number each item. For example:

1. Lorem ipsum dolor sit amet
1. Consectetur adipiscing elit
1. Integer molestie lorem at massa
1. Facilisis in pretium nisl aliquet

Renders to:

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Integer molestie lorem at massa
  4. Facilisis in pretium nisl aliquet


Tables

Tables are created by adding pipes as dividers between each cell, and by adding a line of dashes (also separated by bars) beneath the header. Note that the pipes do not need to be vertically aligned.

| Option | Description |
| ------ | ----------- |
| data   | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext    | extension to be used for dest files. |

Renders to:

Option Description
data path to data files to supply the data that will be passed into templates.
engine engine to be used for processing templates. Handlebars is the default.
ext extension to be used for dest files.

Right Aligned Text

Adding a colon on the right side of the dashes below any heading will right align text for that column.

| Option | Description |
| ------:| -----------:|
| data   | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext    | extension to be used for dest files. |
Option Description
data path to data files to supply the data that will be passed into templates.
engine engine to be used for processing templates. Handlebars is the default.
ext extension to be used for dest files.


Task List

Task lists are a handy way of making lists where items can be "checked" on or off. Like a "To-Do" List. To create a task list, you will use a hyphen, angle brackets and the letter "x".

So the following task list syntax:

- [ ] This item is unchecked
- [x] This item is checked

will render to:

  • This item is unchecked
  • This item is checked


Images

Images have a similar syntax to links but include a prepended exclamation point.

![Minion](http://octodex.github.com/images/minion.png)

Minion

or

![Alt text](http://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")

Alt text

Like links, Images also have a footnote style syntax

![Alt text][id]

Alt text

With a reference later in the document defining the URL location:

[id]: http://octodex.github.com/images/dojocat.jpg  "The Dojocat"


Code

Inline Code

Wrap inline snippets of code with a single accent grave character (aka "tick mark") `.

For example, this markup:

Render these section tags as inline code: `<section></section>`

will render to:

Render these section tags as inline code: <section></section>

Indented Code

Or indent several lines of code by at least four spaces, as in:

    // Some comments
    line 1 of code
    line 2 of code
    line 3 of code
// Some comments
line 1 of code
line 2 of code
line 3 of code

Block Code "Fences"

Use "fences", which are made up of three accent grave marks (aka "tick marks") ``` to block in multiple lines of code. Notice how the "fences" wrap the code with three accent graves at the start of the code block and three accent graves at the end of the code block:

``` 
This text is surrounded by a "fence", so it will get treated like a block of code.

```

Which renders to:

This text is surrounded by a "fence", so it will get treated like a block of code.

Syntax Highlighting

GitHub-Flavored Markdown (GFM) also supports syntax highlighting. To activate it, simply add the file extension (or full name of the language) you want to use directly after the first code "fence", and language-specific syntax highlighting will automatically be applied in the rendered HTML.

For example, to apply syntax highlighting to JavaScript code, both of these formats will render the exact same output:

``` javascript
// javascript code here ...
```

``` js
// javascript code here ...
```

Here is a full example:

``` javascript
// javascript code here ...
const b = stampit().init(function() {
  const priv = 'b';
  this.getB = () => {
    return priv;
  };
});
```

Which renders to:

// javascript code here ...
const b = stampit().init(function() {
  const priv = 'b';
  this.getB = () => {
    return priv;
  };
});


Keyboard Keys

Github-Flavored Markdown (GFM) allows you to render pretty keyboard keys which are particularly useful when instructing your readers on keyboard shortcuts, commands or hotkeys.

For example, the following markdown can be used to display the shortcut for "Copy" and "Paste" on a Mac:

To copy, press <kbd>Cmd</kbd> + <kbd>C</kbd>  
To paste, press <kbd>Cmd</kbd> + <kbd>V</kbd>

Which renders to:

To copy, press Cmd + C
To paste, press Cmd + V



Emojis

Github-Flavored Markdown (GFM) supports Emojis! :bowtie: 😍 πŸ˜„ πŸ’₯ πŸ•

To add an emoji in GFM, just surround the emoji name with colons, like this:

:hamburger: :pizza: :beer: :sushi: :tropical_drink:

Which renders to:

πŸ” πŸ• 🍺 🍣 🍹

Tip: For a full list of supported emojis, check out emoji-cheat-sheet.com



Credit

This cheatsheet was initially inspired by this nice gist by jonschlinkert, but has since evolved with added content, in hopes to one day read like a "Markdown for Dummies Everyone."

About

Explaining the Markdown syntax for inquiring minds.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published