2 votes

Testing markdown

18-Nov-2011: Updated to include the latest markdown changes.

####Contents

  1. Basic text formatting (Italics, Bold, Strikethrough, Super^script, inline code, Quoting)
  1. Linking
  2. Line Breaks & Paragraphs
  3. Lists
  4. Tables
  5. Block Code
  6. Headlines and Horizontals

####1. Basic Text Formatting

Italics are created using either a single asterisk (*) or single underscore (_).

Example:

This is *italic text*, this is also _italic text_.

becomes:

This is italic text, this is also italic text.

Bold text is created with double asterisks (**) or double underscores (__).

Example:

This is **bold text**, this is also __bold text__.

becomes:

This is bold text, this is also bold text.

Strikethrough text is created using a double tilde (~~).

Example:

This is ~~strikethrough text~~.

becomes:

This is strikethrough text.

Superscript text is created using the carot (^).

Example:

This sentence contains super^script.

becomes:

This sentence contains super^script.

Note that you cannot leave space before the carot, and there is no closing tag.

Superscript can also be stacked^like^this.

inline code (monospaced text) is created using the backtick (grave accents) (`).

Example:

This sentence contains inline code: `javascript:alert("hello world");`

becomes:

This sentence contains inline code: javascript:alert("hello world");

Quoting is achieved by starting a line with an Angle Bracket (>)

Example:

>Here's a quote.

>Another paragraph in the same quote.
>>A nested quote.

>Back to a single quote.

And finally some unquoted text.

becomes:

Here's a quote.

Another paragraph in the same quote.

A nested quote.

Back to a single quote.

And finally some unquoted text.

To remove formatting you will need to use a Backslash (\)

Example:

This sentence escapes \*italic text\* and \*\*bold text\*\*.

becomes:

This sentence escapes *italic text* and **bold text**.

####2. Linking

Creating a link

Example:

[Reddit](http://reddit.com)

becomes:

Reddit

You cannot begin a link with "www", it must begin with one of the following URL schemes:

  • http://
  • https://
  • ftp://
  • mailto:
  • steam://
  • irc://
  • news://
  • mumble://
  • ssh://

You can also provide title text for links:

[Reddit](http://reddit.com "what's new online!").

becomes:

Reddit ← (hover!)

Title text can be used to hide spoilers:

[spoiler](/s"The spoiler text goes here")

becomes:

[spoiler](/s"The spoiler text goes here") ← (hover!)

Reddit now recognises when you want to link to a subreddit.

Example:

This is a shameless plug for /r/BritishTV!

becomes:

This is a shameless plug for /r/BritishTV!

If a URL contains brackets you will need to escape these.

Example without escaping:

[Cube](http://en.wikipedia.org/wiki/Cube_(film))

becomes:

Cube ← (note the surplus bracket!)

Example with escaping:

[Cube](http://en.wikipedia.org/wiki/Cube_(film\))

becomes:

[Cube](http://en.wikipedia.org/wiki/Cube_(film\)) ← (no surplus bracket!)

####3. Line Breaks & Paragraphs

Line breaks in comments are achieved by adding four spaces (shown using ░) to the end of the line. Simply hitting return (shown using ↵) will not work.

Example:

First line↵
Second line

becomes:

First line Second line

but:

First line░░░░↵
Second line

becomes:

First line
Second line

Paragraphs are formed when you hit return (shown using ↵) twice.

First Paragraph↵

Second Paragraph

becomes:

First Paragraph

Second Paragraph

####4. Lists

To create Unordered Lists each item should begin with either an asterisk (*), plus sign (+) or minus sign (-).

Example:

* Item 1
+ Item 2
- Item 3

becomes:

  • Item 1
  • Item 2
  • Item 3

Ordered Lists are created with a number and period. It doesn't matter which number you start with, as markdown will always start with 1.

Example:

3. Item 1
2. Item 2
1. Item 3

becomes:

  1. Item 1
  2. Item 2
  3. Item 3

The markup for Nested Lists has changed slightly:

Example:

1. This is Item 1
2.
░░░░1. This is Item 2.1
░░░░2. This is Item 2.2
3. This is Item 3
4. This is Item 4

becomes:

  1. This is Item 1
    1. This is Item 2.1
    2. This is Item 2.2
  2. This is Item 3
  3. This is Item 4

Lists should be clear of any text in the line immediately above and below, the same as making a new paragraph:

This is the wrong way to make a list

  1. lorem
  2. ispum
    reddit doesn't realize it should listify...

becomes:

This is the wrong way to make a list

  1. lorem
  2. ispum
    reddit doesn't realize it should listify...

Place lists in their own paragraph:

This is the correct way to make a list

  1. lorem
  2. ispum

reddit realizes it should listify!

Paragraphs in Lists and Nested lists using a combination of ordered and unordered lists, are no longer supported.

####5. Tables

Tables are created using pipes (|):

Example

Left align | Center align | Right align
:--|:--:|--:
This | This | This
column | column | column
will | will | will
be | be | be
left | center | right
aligned | aligned | aligned

becomes:

Left align Center align Right align
This This This
column column column
will will will
be be be
left center right
aligned aligned aligned

Note that by default the first row is always bolded.

Column Alignment is determined by the second row.

Use ":--:" for centre aligned text, "--:" for right, and ":--" for left.

You can also leave the top row empty, as long as you have the correct amount of pipes:

||
:--|:--:|--:
the|top|row
is|now|empty

becomes

| |
:--|:--:|--:
the|top|row
is|now|empty

####6. Block code

Displaying block code, without formatting and in monospaced font, is as simple as starting the line with four spaces (shown using ░).

Example:

░░░░line of code
░░░░░░░░line of code
░░░░░░░░░░░░line of code
░░░░░░░░line of code
░░░░line of code

becomes:

    line of code
        line of code
            line of code
        line of code
    line of code

####7. Headlines & Horizonal Rules

Headline text can be created by using a number of hashes (#) corresponding to the tag you want. Headline tags will format all text until it encounters a Line Break or new Paragraph.

# Headline 1
## Headline 2
### Headline 3

becomes:

#Headline 1
##Headline 2
###Headline 3

NOTE: Markdown supports up to six headline tags, but only the first three have default formatting.

To create a Horizontal Rule, simply add three asterisks (*) to an empty line.

***

becomes:


1 comment

  1. creesch
    Link
    h1 Heading 8-) h2 Heading h3 Heading h4 Heading h5 Heading h6 Heading Horizontal Rules Emphasis This is bold text This is bold text This is italic text This is italic text Strikethrough...

    h1 Heading 8-)

    h2 Heading

    h3 Heading

    h4 Heading

    h5 Heading
    h6 Heading

    Horizontal Rules




    Emphasis

    This is bold text

    This is bold text

    This is italic text

    This is italic text

    Strikethrough

    Blockquotes

    Blockquotes can also be nested...

    ...by using additional greater-than signs right next to each other...

    ...or with spaces between arrows.

    Lists

    Unordered

    • Create a list by starting a line with +, -, or *
    • Sub-lists are made by indenting 2 spaces:
      • Marker character change forces new list start:
        • Ac tristique libero volutpat at
        • Facilisis in pretium nisl aliquet
        • Nulla volutpat aliquam velit
    • Very easy!

    Ordered

    1. Lorem ipsum dolor sit amet

    2. Consectetur adipiscing elit

    3. Integer molestie lorem at massa

    4. You can use sequential numbers...

    5. ...or keep all the numbers as 1.

    Start numbering with offset:

    1. foo
    2. bar

    Code

    Inline code

    Indented code

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

    Block code "fences"

    Sample text here...
    

    Syntax highlighting

    var foo = function (bar) {
      return bar++;
    };
    
    console.log(foo(5));
    

    Tables

    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 columns

    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.

    Links

    link text

    link with title

    Autoconverted link https://github.com/nodeca/pica (enable linkify to see)

    Images

    !Minion
    <img src="https://octodex.github.com/images/stormtroopocat.jpg" alt="Stormtroopocat" title="The Stormtroopocat" />

    Like links, Images also have a footnote style syntax

    <img src="https://octodex.github.com/images/dojocat.jpg" alt="Alt text" title="The Dojocat" />

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

    Plugins

    The killer feature of markdown-it is very effective support of
    syntax plugins.

    Emojies

    Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:

    Shortcuts (emoticons): :-) :-( 8-) ;)

    see how to change output with twemoji.

    Subscript / Superscript

    • 19^th^
    • H~2~O

    <ins>

    ++Inserted text++

    <mark>

    ==Marked text==

    Footnotes

    Footnote 1 link[^first].

    Footnote 2 link[^second].

    Inline footnote^[Text of inline footnote] definition.

    Duplicated footnote reference[^second].

    [^first]: Footnote can have markup

    and multiple paragraphs.
    

    [^second]: Footnote text.

    Definition lists

    Term 1

    : Definition 1
    with lazy continuation.

    Term 2 with inline markup

    : Definition 2

        { some code, part of Definition 2 }
    
    Third paragraph of definition 2.
    

    Compact style:

    Term 1
    ~ Definition 1

    Term 2
    ~ Definition 2a
    ~ Definition 2b

    Abbreviations

    This is HTML abbreviation example.

    It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.

    *[HTML]: Hyper Text Markup Language

    Custom containers

    ::: warning
    here be dragons
    :::