paulgorman.org

Markdown Notes

The is a summary of the official Markdown syntax document.

You can put real HTML anywhere in a Markdown document, but block-level elements (div, table, pre, p) need a blank line before and after. Also, markdown syntax inside HTML is not processed.

& and <, (and many other special characters) are automatically translated to HTML entities (&amp;).

Paragraphs are separated by blank lines.

Non-paragraph line breaks (<br />) can be made by putting 2 spaces after the line.

Header H1
=========

Header H2
---------

# Header H1 #

## Header H2 ##

### Header H3 ###

#### Header H4 ####

> A blockquote

> > A nested blockquote

* Bulleted list
* Bulleted list
* Bulleted list

1. Numbered list 1
2. Numbered list

    Sub-paragraphs within list items must be indented 4 spaces.

2. Numbered list (actual numbers don't matter)

Use *single asterisks* or _underscores_ for <em>.

Use **double asterisks** or __doubled underscores__ for <strong>.

A horizontal rule:

---------------

`backticks` are for <code>.

    Indent pre-formatted blocks 4 spaces.

The carrot-ed URL <http://paulgorman.org> will be hyperlinked.

[This](http://paulgorman.org) will be hyperlinked.

A link within the same document works like [this][foo], and links to the paragraph below.

[foo]: This is the target of a link withing the same document.

![Alt text](/path/to/img.jpg)

![Alt text](/path/to/img.jpg "Optional title")

Use a backslash to escape any literal character that's wrongly interpreted as markdown.

Extensions

Besides `markdown.pl`, a number of processors are available, like Pandoc and kramdown. The other processors support extensions for the markdown syntax.

Definition lists are like this:

A term
: The definition

Another term
: Another definition

Pandoc

Pandoc outputs HTML like pandoc -S5 input.txt -o output.html (-S outputs dash and ellipses as entities, and -5 generates HTML5 instead of 4), or LaTeX like pandoc input.txt -o output.tex. The -s option adds standard headers and footers to the output, rather than a fragment. The -t and -f explicitly specify the to and from formats, like pandoc -f html -t makrdown input.html to output HTML as markdown.

If no output file is specified, results go to stdout.

The --smart option converts straight quotes to curly quotes,
--- and -- to Em-dashes, and ... to ellipses.

<!-- HTML comments work -->

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1

Table:  Demonstration of simple table syntax.

Multi-line tables are also supported:

-------------------------------------------------------------
 Centered   Default           Right Left
  Header    Aligned         Aligned Aligned
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------

Table: Here's the caption. It, too, may span
multiple lines.

Document header:

% title
% author(s) (separated by semicolons)
% date

kramdown

--- renders as an em-dash
-- renders as an en-dash
... renders as an ellipsis

{::comment}
A comment ignored by kramdown
{:/comment}

| Table header 1 | Table header 2 | Table header 3 | Table header 4 |
|:---------------|:--------------:|---------------:|----------------|
| left aligned   | center aligned | right aligned  | default align  |