Pandoc / Markdown Extra

Syntax Cheatsheet
========================================
PHRASE EMPHASIS
---------------
*emphasis4*   **strong2**   inword*emphasis4*  *emphasis4*inword  in*middle4*emphasis  \
_emphasis3_   __strong1__   ending_snake_     _starting_snake   snake_case_test   

\ asdf

### Pandoc

~~strikethrough~~; ~~more strikethrough~~ \
subscript: CO~2~; ~6~C; H~2~O; subscript~with\ escaped\ blanks~ \
superscript: 2^10^ = 1024; ^14^C; some^more^power base^power\ with\ escaped\ blanks^

Escaping characters:
--------------------
### Markdown
```
\`*_{}[]()>#+-.!
```

### Pandoc
> Except inside a code block or inline code, any punctuation or space character preceded by a backslash will be treated literally



> A backslash-escaped space is parsed as a nonbreaking space.

```
\ 
```
Like\ all\ spaces\ in\ this\ test.


LINKS
---------------
Inline:
An [example](http://url.com/ "Title")

Reference-style labels (titles are optional):
An [example][id]. Then, anywhere  
else in the doc, define the link:

  [id]: http://example.com/  "Title"

IMAGES
---------------
Inline (titles are optional):
![alt text](/path/img.jpg "Title")

Reference-style:
![alt text][id]

  [id]: /url/to/img.jpg "Title"

HEADERS
---------------
Setext-style:
Header 1
========

Header 2
--------

atx-style (closing #'s are optional):

# Header 1 #

## Header 2 ##

###### Header 6

### Pandoc

> This identifier is based on the text of the header. To derive the identifier from the header text,
> 
> * Remove all formatting, links, etc.
> * Remove all punctuation, except underscores, hyphens, and periods.
> * Replace all spaces and newlines with hyphens.
> * Convert all alphabetic characters to lowercase.
> * Remove everything up to the first letter (identifiers may not begin with a number or punctuation mark).
> * If nothing is left after this, use the identifier "section".
  
###### Header identifiers in HTML
header-identifiers-in-html

######Dogs?–in my house?
dogs--in-my-house

######HTML, S5, or RTF?
html-s5-or-rtf

######3. Applications
applications

######33
section

### Markdown Extra

### My extension: (level 4)

This was suggested by a friend of mine:

#= Same level as before (level4)

#+ one level deeper (level5)

#++ again two levels deeper (level7)

##= same level as before (level 7)

You can use as many '#'s as you want; they don't affect the level.

##- one level up (level 6 again)



LISTS
---------------
Ordered, without paragraphs:

1.  Foo
2.  Bar

Unordered, with paragraphs:

*   A list item.

    With multiple paragraphs.

*   Bar

You can nest them:

*   Abacus
    * ass
*   Bastard
    1.  bitch
    2.  bupkis
        * BELITTLER
    3. burper
*   Cunning

### Pandoc

Roman numerals:

i. primus
ii. secundus
iii. tertius

Alphabetic lists

a. alpha
b. bravo
c. charly

You can start or recommence at any letter:

d. delta
e. epsilon

However "i", "v" and "x" will be automatically seen as roman numerals:

v. quintus
vi. sextus


Uppercase lists need an extra blank after the "." not to make e.g. "A. Einstein", "B. Obama" etc. get a list. 

Uppercase roman numerals:

I.  PRIMVM
II.  SECVNDVM
III.  TERTIUM

Uppercase alphabetic lists:

A.  Alpha
B.  Bravo
C.  Charly

Default ol marker:

#. start at one
#. continue at two

Also use the default marker to contiune any list:

i. roman lowercase
#. more roman lowercase

### My extensions

Pandoc alphabetic lists only go up to "z". Mine continue with "aa" and so forth:

z. zebra
aa. alpha alpha
ab. alpha beta

To be consistent, also more than one letter uppercase alphabetic lists need an extra space after the dot.

AC.  Alpha Charly
AD.  Alpha Delta

In more than one letter list starters anything that can be interpreted as a roman numeral (that is, containing only "ivxlcdm") will be automatically set as such.

MM.  Millenium
MMI.  2001

To inverse this behaviour, use ":" or three blanks after the dot (not implemented yet):

mm: Martha Martha
mn: martha northpole

or

i: start at alphabetic "i"
j: continue with "j"

Three space example:

v.   Value
w.   Wisdom
x.   Xylophone

* Pandoc requires to start a new list if the style changes (not implemented yet)
	* I'm not sure how my style should handle this

BLOCKQUOTES
---------------
> Email-style angle brackets
> are used for blockquotes.

> > And, they can be nested.[^nestedquotes]

> #### Headers in blockquotes
> 
> * You can quote a list.
> * Etc.

[^nestedquotes]: However in Pandoc `>>` should not produce a nested blockquote!

CODE SPANS
---------------
`<code>` spans are delimited
by backticks.

You can include literal backticks
like `` `this` ``.

PREFORMATTED CODE BLOCKS
---------------
Indent every line of a code block by at least 4 spaces or 1 tab.

This is a normal paragraph.

    This is a preformatted
    code block.

HORIZONTAL RULES
---------------
Three or more dashes or asterisks:

---

* * *

- - - -

MANUAL LINE BREAKS
---------------
End a line with two or more spaces:

Roses are red,   
Violets are blue.

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

Footnotes
---------------
This footnote will appear at the bottom of the document[^1].

The footnote doesn't have to be a number[^nonumber].

Yet another referece to the bottom of the document[^1] won't work yet in js-markdown,
but duplicate the footnote in pandoc, which has been [discussed in the forums](https://github.com/jgm/pandoc/issues/224)

[^1]: Told you it'd be here at the bottom. Footnote inside footnotes do work in js-markdown-extra[^3], but not in pandoc.
[^nonumber]: See, not a number.
             Though it does appear as a number in the html's ordered list.
             
[^3]: this is a footnote inside a footnote which won't work in pandoc!
             
### Pandoc

Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]

Markdown Style Tables
---------------------

this should not have empty cells before it:

|a |b |c
|--|--|--
|1 |2 |3

or

a |b |c
--|--|--
1 |2 |3

alignment

  rigt|left  | center
-----:|:-----|:------:
 0001 | 2    | 003
   4  | 0005 |  6
   

### My extensions

: with footer

|head|head|head
|----|----|----
|body|body|body
|body|body|body
|----|----|----
|foot|foot|foot


: headerless

|----|----|----
|body|body|body
|body|body|body


: headerless with footer

|----|----|----
|body|body|body
|body|body|body
|----|----|----
|foot|foot|foot


Use ``'`` to add text to the cell above.
This allows for block elements inside the table!

|a |b             |c
|--|--------------|--
|1 |Write in more |3
'1 'than one line '3



Use `^` to add text to the cell above *and* extend the **rowspan**:

|a        |b      |c
|---------|-------|--
|vertical |awsome |3
^span     |great  |6


Use more than one `|` (or `^ ` or `' `) to extend the **colspan**
(This is inspired by Multimarkdown):

|combined || c 
|----|----|---
|1   |2   |3  
| 4  | 5 & 6 ||


If there is no cell above to put the content into, the row above will be extended with empty cells until there is a place to put it in:

| a  | b  | c 
|----|----|---
|1   |2   |3
|4   |5   |6  ^ 7
|8   |9   |10 
|11  |12  |13 ' 14

is the same as

| a  | b  | c 
|----|----|---
|1   |2   |3  |   |
|4   |5   |6  ^ 7
|8   |9   |10 |   |
|11  |12  |13 ' 14

* I do not recommend to mix rows with real cells (`| ` and `^ `) and rows with extending cells (`' `) as this can make the table look very weird. Also the following might not be expected:

| a  | b  | c 
|----|----|---
|1   |2   |3 
|4   '5   |6 

is the same as


| a  | b  | c 
|----|----|---
|1   |2   |3
'    '5   '
|4   |    |6 


Use `= `s to make the whole column to ``<th>``s:

a   |b |c
====|--|--
th1 |2 |3
th4 |5 |6


Use a second row with `- ` to get `<tfoot>` (like `<thead>`):

a |b |c
--|--|--
1 |2 |3
4 |5 |6
--|--|--
x |y |z

Use `;` next to the the end of the cell to set *single cell* align: 

a     |b     |c
------|------|--
right;|222222222222     |;center;|
444444444444     |;left |66666666666666
asdf|asdf|asdf

The same applies for vertical align:

|a                |b      |c
|-----------------|-------|--
|right         \ ;|2      |;center;
'...            \ '2      ' top    
'middle          ;'       '        
|444444444444444\ | left  |6666666666 \
'444444444444444  ';bottom'6666666666

Like in Markdown Extra, you can set align for the rest of the column with `:`.
You can do this in any cell, not just in the `-----` line.
It gets stopped by the next single cell align.

|right :|default| c
|-------|:------|--------
|  right|left   | 3
|  right|left   | 6
|;left  |left   |:center:
|default|left   | center

Again, the same applies for vertical align, only that it sets the
vertical align for the rest of the *row*.

: Single cell vertical alignment 

|---------|---------|----------|
| default | default | default\ |
'         '         ' ...    \ '
'         '         ' ...      '
|; top    | default | default\ |
'         '         ' ...    \ '
'         '         ' ...      '
| bottom  | default | default\ |
'         '         ' ...    \ '
';        '         ' ...      '
|  middle | default | default\ |
';        '         ' ...    \ '
'         '         ' ...      '
|; middle | default | default\ |
'         '         ' ...    \ '
';        '         ' ...      '
|---------|---------|----------|



: Whole row vertical alignment

|---------|---------|---------|----------|
| default | default | default | default\ |
'         '         '         ' ...    \ '
'         '         '         ' ...      '
|: top    | top     |;top     | default\ |
'         '         '         ' ...    \ '
'         '         '         ' ...      '
| bottom  | bottom  | bottom  | default\ |
'         '         '         ' ...    \ '
':        '         ';        ' ...      '
|  middle | middle  | middle  | default\ |
':        '         ';        ' ...    \ '
'         '         '         ' ...      '
|: middle | middle  |;middle  | default\ |
'         '         '         ' ...    \ '
':        '         ';        ' ...      '
|---------|---------|---------|----------|
								
																		
|             ||top    |bottom|middle|justify|default
|=====|========|-------|------|------|-------|-------
|next | l \| r |justify|bottom|bottom|bottom |bottom
^row  |-l \| r |top    |middle|middle|top    |default


Maybe some symbol instead of ":" for horizontal pass on of horizontal align?


	|----------|---------|---------|
	|> center >| center  | center  |
	| default  | default | default |
	|----------|---------|---------|


Then ">" would maybe pass on vertical align horizontally too?

	|----------|---------|---------|
	|> middle  | middle  | middle  |
	'>         '         '         '
	| default  | default | default |
	|----------|---------|---------|


And ":" would pass on horizontal *and* vertical align vertically?

	|----------|---------|---------|
	|: middle  | default | default |
	':         '         '         '
	| middle   | default | default |
	|----------|---------|---------|



Pandoc Style Tables
---------------------

### Gridtables

+---+---+
| a | b |
+===+===+
| c | d |
+---+---+

+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+
| G | H | I |
+---+---+---+



#### My extensions

Gridless tables:

+   +   +   +
  A   B   C  
+   +   +   +
  D   E   F  
+   +   +   +
  G   H   I  
+   +   +   +

Forcing spanning cells (combines B & E):

+   +   +   +
  A   B | C  
+   +   +   +
  D   E | F  
+   +   +   +
  G   H   I  
+   +   +   +


Forcing spanning cells (combines D & E):

+   +   +   +
  A   B   C  
+   +   +   +
  D   E   F  
+  -+-  +   +
  G   H   I  
+   +   +   +

Combination test:
B gets ignored, because it looks like a rowspan in line 1, then D & E spans past B.

+   +   +   +
  A   B | C  
+   +   +   +
  D   E | F  
+  -+-  +   +
  G   H   I  
+   +   +   +



Automatic Rowspan and Colspan. If any symbol that my not normally appear in a border gets
in between the border, it is interpreted as a spanning cell.

vertically:

+---+---+---+  
| A | B | C |  
+---+ J +---+  
| D | E | F |  
+---+---+---+  
| G | H | I |  
+---+---+---+


without borders:

+   +   +   +
  A   B   C  
+   + J +   +
  D   E   F  
+   +   +   +
  G   H   I  
+   +   +   +


horizontally:

+---+---+---+ 
| A | B | C | 
+---+---+---+ 
| D J E | F | 
+---+---+---+ 
| G | H | I | 
+---+---+---+ 

without borders:

+   +   +   +
  A   B   C  
+   +   +   +
  D J E   F  
+   +   +   +
  G   H   I  
+   +   +   +

##### text-align

The borders of the gridtable must consist of the
following characters: `-` for horizontal lines, `|` (for
vertical lines), `=` (for headers), `:` (for sticky alignment),
`;` (for single alignment) or space (for automatic lines).

###### horizontal alignment

`;----` will align the cell below it *left*.\
`----;` will align the cell below it *right*.\
`;---;` will align the cell below it *justified*.[^centervsjust1]\
`--;--` will align the cell below it *centered*; the ';'
can be anywhere in the middle.[^centervsjust2] \
(`;--"."--`, `--"."--;`, `;--"."--;`, `--;"."--` or
 `.;----`, `-----;.`, `.;----;.`, `--;.;--` are planned
to align the cell below it *to the char* between the `"`s.)

* If you use `:` instead of `;`, all of the following cells in the same *column* will be aligned until another single cell alignment stops it again. (Until now there is no way to set the horizontal alignment of a whole *row*.) You can use any alignment in the single cell to stop the previous alignment.


: Single cell horizontal alignment 

+---------+;--------+--------;+----;----+;-------;+
| default | left    | right   | center  | justify |
+---------+---------+---------+---------+---------+
| default | default | default | default | default |
+---------+---------+---------+---------+---------+


: Whole column horizontal alignment 

+---------+:--------+--------:+----:----+:-------:+
| default | left    | right   | center  | justify |
+---------+---------+---------+---------+---------+
| default | left    | right   | center  | justify |
+---------+;-------;+;--------+--------;+----;----+
| default | justify | left    | right   | center  | 
+---------+---------+---------+---------+---------+
| default | default | default | default | default |
+---------+---------+---------+---------+---------+


[^centervsjust1]: im not yet sure how to solve this problem.
[^centervsjust2]: im not yet sure how to solve this problem.




###### vertical alignment

`;||||` will align the cell right to it *top*.\
`||||;` will align the cell right to it *bottom*.\
`;|||;` will align the cell right to it *middle*.\
`||;||` will align the cell right to it *middle*; the ';'
can be anywhere in the middle.

* If you use `:` instead of `;`, all of the following cells in the same *row* will be aligned until another single cell alignment stops it again. (Until now there is no way to set the vertical alignment of a whole *column*.) You can use any alignment in the single cell to stop the previous alignment.

: Single cell vertical alignment 

+---------+---------+----------+
| default | default | default\ |
|         |         | ...    \ |
|         |         | ...      |
+---------+---------+----------+
; top     | default | default\ |
|         |         | ...    \ |
|         |         | ...      |
+---------+---------+----------+
| bottom  | default | default\ |
|         |         | ...    \ |
;         |         | ...      |
+---------+---------+----------+
| middle  | default | default\ |
;         |         | ...    \ |
|         |         | ...      |
+---------+---------+----------+
; middle  | default | default\ |
|         |         | ...    \ |
;         |         | ...      |
+---------+---------+----------+



: Whole row vertical alignment 

+---------+---------+---------+----------+
| default | default | default | default\ |
|         |         |         | ...    \ |
|         |         |         | ...      |
+---------+---------+---------+----------+
: top     | top     ; top     | default\ |
|         |         |         | ...    \ |
|         |         |         | ...      |
+---------+---------+---------+----------+
| bottom  | bottom  | bottom  | default\ |
|         |         |         | ...    \ |
:         |         ;         | ...      |
+---------+---------+---------+----------+
| middle  | middle  | middle  | default\ |
:         |         ;         | ...    \ |
|         |         |         | ...      |
+---------+---------+---------+----------+
: middle  | middle  ; middle  | default\ |
|         |         |         | ...    \ |
:         |         ;         | ...      |
+---------+---------+---------+----------+


: Whole row vertical alignment and whole column horizontal alignment

+---------+:--------+--------:+----:----+:-------:+---------+
|default\ |default\ |default\ |default\ |default\ | * asdf  |
|default\ | left  \ | right \ | center\ |justify\ | * asdf  |
| ...     | ...     | ...     | ...     | ...     | * asdf  |
+---------+---------+---------+---------+---------+---------+
: top\    | top ! \ ; top\    |default\ |default\ | * asdf  |
|default\ | left  \ | right \ | center\ |justify\ | * asdf  |
| ...     | ...     | ...     | ...     | ...     | * asdf  |
+---------+---------+---------+---------+---------+---------+
| bottom\ | bottom!\| bottom\ |default\ |default\ | * asdf  |
|default\ | left  \ | right \ | center\ |justify\ | * asdf  |
: ...     | ...     ; ...     | ...     | ...     | * asdf  |
+---------+;--------+--------;+----;----+;-------;+---------+
| middle\ | middle\ | middle\ |default\ |default\ | * asdf  |
:default\ | left  \ ; right \ | center\ |justify\ | * asdf  |
| ...     | ...     | ...     | ...     | ...     | * asdf  |
+---------+---------+---------+---------+---------+---------+
: middle\ | middle\ ; middle\ |default\ |default\ | * asdf  |
|default\ |default\ |default\ |default\ |default\ | * asdf  |
: ...     | ...     ; ...     | ...     | ...     | * asdf  |
+---------+---------+---------+---------+---------+---------+

##### Table headers

: Single cell `th`

+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+===+---+
| G | H | I |
+---+---+---+


: `th`s on the left[^leftth]

+---+---+---+
| A | B | C |
+===+---+---+
| D | E | F |
+===+---+---+
| G | H | I |
+===+---+---+

[^leftth]: maybe there's going to be a better syntax for this.


Automatic `thead` and `tfoot` recognition will use all rows at the top and at the bottom containing only `th`. Notice that in manual mode you can also use `td` inside them.

: automatic thead

+---+---+---+
| A | B | C |
+===+===+===+
| 7 | E | F |
+---+---+---+
| G | H | I |
+---+---+---+


: automatic tfoot (not yet implemented)

+---+---+---+
| A | B | C |
+===+===+===+
| 7 | E | F |
+---+---+---+
| G | H | I |
+===+===+===+

: manual thead and tfoot (not yet implemented)

+---+---+---+
| A | B | C |
+---+---+---+

| 7 | E | F |

+---+---+---+
| G | H | I |
+---+---+---+


In layz style make sure not to type `=+=` as this will be colspan!

: in lazy style

+      +   + +
 Header row 1
+ ==== + = +=+
 Header row 2
+ ==== + = +=+
 body   bla h
+      +   + +
 more   bla h
+      +   + +
 footer row 1
+ ==== + = +=+
 footer row 2
+ ==== + = +=+

: original pandoc lazy style

+---+---+----+
|makethemhapp
+===+===+====+
|I'm not sure
+---+---+----+
|IfIlike that
+---+---+----+

At some point I might implement [other symbols](http://en.wikipedia.org/wiki/Box-drawing_character) for table borders 

Definition list
-----------------

term
 : definithion

term
 : definithion
 : is here

term
 : definithion

 : can have multi paragraph

Auto link
-----------------

<http://foo.com/>  
<mailto:foo@bar.com>

Encode
-----------------

& < "aaa"

Inline HTML
-----------------

<p>
HTML is represented as is.<br>
<del>The <strong>quick brown fox</strong> jumps over the lazy dog.</del>
</p>

<div>
Regularly Markdown syntax ignored in HTML.<br/>
[Google](http://www.google.co.jp/)
</div>

<div markdown="1">
Markdow enabled inside HTML when marked by markdown="1" attribute.  
[Google](http://www.google.co.jp/)
</div>


Form Elements
-------------

	[_] and [*] for checkboxes
	(_) and (*) for radios etc.

* https://github.com/maleldil/wmd/blob/master/showdown.js
* uses MIT type license



Command line usage
------------------

http://javascript.cs.lmu.edu/notes/commandlinejs/

    

Html