HTML Header Level | LaTeX Header Level | LaTeX Input | LaTeX input | thmd | title | subtitle | Keywords | Revision | Language | author | Affiliation | LaTeX Mode | tocd | secd | LaTeX Footer | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 |
2 |
mmd-load-toc |
mmd-natbib-plain |
chapter |
Yet Another Markdown Cheatsheet |
Including MarkDown, MultiMarkdown, pandoc, GFM and LaTeX Math Syntax by MathJax |
MarkDown, MultiMarkDown, LaTeX, pandoc, gfm |
0.1 |
English |
Kolen Cheung |
khcheung@berkeley.edu |
University of California, Berkeley |
memoir |
5 |
5 |
mmd-memoir-footer |
{:.no_toc}
- Will be replaced with the ToC, excluding the "Contents" header {:toc}
{{TOC}}
[Examples][] shows explicit examples for different syntaxes. [Other Syntaxes][] show the syntaxes that can't be shown explicitly.
- Header levels (except possibly the last header level): features in groups
- Last header level or a list: different syntaxes
- TaskPaper-styled tags to indicate in what favor of Markdown such syntax is supported
@markdown
: supported by original markdown, hence understood to be supported by all variants of markdown@ghpages
: GitHub-Favored Markdown, built by kramdown with GFM option. i.e. GitHub Pages' GitHub-Favored Markdown (not exhaustively tested here. See kramdown's documentation for other possible syntaxes)@mmd
: MultiMarkdown@pandoc
: pandoc-favored markdown@phpextra
: PHP Markdown Extra (inspired some syntax in pandoc and mmd and gfm, not exhaustively tested here)
- TaskPaper Tags
@...(partial)
: partial supports only@...(+...)
: when the extension is used@pandoc(--...)
: when the command line argument is used@pandoc(parsed)
: not verbatim, but parsed
Note:
- You might see
<!-- \begin{comment} -->...<!-- \end{comment} -->
. This is for mmd to tex to pdf use only. Ignore this.
@markdown
See [Emphasis][] and [Other Syntaxes][] to see alternative Setext-style header styles @markdown
Header Containing Styling and a Link
@markdown
@pandoc @phpextra
@pandoc
@pandoc
- Link to Header @pandoc @ghpages @mmd
- [Link to Header][Header] @pandoc @mmd
- [Header][] @mmd @pandoc
- [Header] @mmd @pandoc
- [userdefinedreference][] @mmd
- Link to userdefinedreference @mmd @pandoc(+mmd_header_identifiers)
- Link to "Header Containing Attributes" @pandoc
- another-link @pandoc
*testing* @markdown
- italic or italic @markdown
- bold or bold @markdown
- bold italic or bold italic @markdown
strikethrough@pandoc- Small caps @pandoc @markdown(html)
@mmd
Visually it looks like emphasis. Functionally it is much more, and called Critic Markup
- Deletions from the original text: This is {--is --}a test.
- Additions: This {++is ++}a test.
- Substitutions: This {~~isn't~>is~~} a test.
- Highlighting: This is a {==test==}.
- Comments: This is a test{>>What is it a test of?<<}.
See more at CriticMarkup---MultiMarkdown Documentation.
@markdown
3 or more hyphens or asterisks
@markdown
No break like this
Soft break
like this
Hard break
like this
- x^2 @mmd
- d~o @mmd
- x^a+b^ @mmd @pandoc
- x
y,z@mmd @pandoc - P
a\ cat@pandoc
@markdown(+smartypants) @pandoc(--smart) @ghpages
- "Example 1"
- 'Example 2'
- en--dash
- em---dash
- ellipsis...
@mmd
- ``Example 3''
@mmd @phpextra @pandoc(+abbreviations)
*[HTML]: HyperText Markup Language *[W3C]: World Wide Web Consortium *[PANDOC]: Pandoc will simply ignore this if the extension is used. A graceful fallback.
Testing abbreviations: HTML, W3C (mouseover it to see)
The following effects are the same for different kind of lists @markdown
- test 1
- test 2
- test 3
-
test 1
-
test 2
-
test 3
@markdown
- test
- test
- test
@markdown
- test
- test
- test
@markdown
- test
- test
- test
- test
- test
- test
- test
- test
- test
- test
- test
Note about LaTeX output in mmd/pandoc:
- The Maximum nesting level of lists in LaTeX is 4. The quick hack is to mix itemize and enumerate alternatively to go beyond this.
@markdown
- one
- two
- three
- uno
- dos
- tres
- item one
- item two
{ my code block }
@markdown
-
First paragraph.
Continued.
-
Second paragraph. With a code block, which must be indented eight spaces:
{ code }
@pandoc
#. one
#. two
9) Ninth
10) Tenth
11) Eleventh
i. i
ii. ii
iii. iii
(2) Two
(5) Three
- Four
- Five
@mmd @phpextra @pandoc @ghpages
Physics : The Fundamental of Science : Describe the Nature : Make Prediction
@ghpages @pandoc @mmd
Term 1
: Definition 1
Term 2 with inline markup
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
@pandoc
(@) My first example will be numbered (1). (@) My second example will be numbered (2).
Explanation of examples.
(@) My third example will be numbered (3).
(@good) This is a good example.
As (@good) illustrates, ...
testing
@markdown\[\ket{a}\]
{.latex} @pandoc
@markdown
test
test
test
# test
@markdown(partial:language-not-supported) @ghpages @pandoc @mmd
\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}
@pandoc
test
test
test
# test
test
test
test
# test
@markdown
test
test
test
- test
- test
@markdown
\newcommand...
@ghpages(partial) @pandoc
| The limerick packs laughs anatomical | In space that is quite economical. | But the good ones I've seen | So seldom are clean | And the clean ones so seldom are comical
| 200 Main St. | Berkeley, CA 94718
@ghpages @pandoc @mmd
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
: Notice how pandoc can have optional caption like this
@mmd
[Table Caption] | | Grouping ||
Left align | Right align | Center align |
---|---|---|
This | This | This |
column | column | column |
will | will | will |
be | be | be |
left | right | center |
aligned | aligned | aligned |
And a big grouping is like this |
@pandoc
Right Left Center Default
12 12 12 12
123 123 123 123
1 1 1 1
Table: Demonstration of simple table syntax.
@pandoc
Centered Default Right Left Header Aligned Aligned Aligned
First row 12.0 Example of a row that spans multiple lines.
Table: Here's the caption. It, too, may span multiple lines.
@pandoc
: Sample grid table.
+---------------+---------------+--------------------+ | Fruit | Price | Advantages | +===============+===============+====================+ | Bananas | $1.34 | - built-in wrapper | | | | - bright color | +---------------+---------------+--------------------+ | Oranges | $2.10 | - cures scurvy | | | | - tasty | +---------------+---------------+--------------------+
@ghpages
|-----------------+------------+-----------------+----------------|
Default aligned | Left aligned | Center aligned | Right aligned |
---|---|---|---|
First body part | Second cell | Third cell | fourth cell |
Second line | foo | strong | blah |
Third line | blah | blah | bar |
-----------------+------------+-----------------+---------------- | |||
Second body | |||
2 line | |||
=================+============+=================+================ | |||
Footer row | |||
-----------------+------------+-----------------+---------------- |
- https://www.wikipedia.org @pandoc(+autolink_bare_uris)
- https://www.wikipedia.org @markdown
- Wikipedia.org @markdown
- Wikipedia.org @markdown
- Mail to GitHub @markdown
- Search here @markdown
- A [link][] with attributes. @mmd
- [Another link to the link above][link]. @mmd
- A link1 with attributes. @markdown
- Another link. @markdown
- link3. @markdown
[link]: image.png "Title" class=external style="border: solid black 1px;"
- Footnotes [^This is a mmd inline footnote] @mmd
- Footnotes ^[This is a pandoc inline footnote] @pandoc
This paragraph won't be part of the note, because it isn't indented.
A special kind of footnote 3. @mmd
See more at Glossary---MultiMarkdown Documentation.
It can looks like footnotes in HTML output.
@mmd
- This is a statement that should be attributed to its source [p. 23][#Doe:2006].
[Not cited][#notcited]
[#Doe:2006]: John Doe. Some Big Fancy Book. Vanity Press, 2006.
[#notcited]: John Doe. Another Big Fancy Book. Vanity Press, 2016.
See more at Citations---MultiMarkdown Documentation.
@pandoc
Very powerful but complicated. See more at Citations---Pandoc Documentation.
- @markdown
- ![An Image with Attributes][wikipedia] @mmd @pandoc(+mmd_link_attributes)
- {#id .class width=30 height=20px} @pandoc @phpextra(partial)
- a reference ![image][ref] with attributes. @pandoc @phpextra(partial)
[wikipedia]: image.png "Title of the Image" width=40px height=40px
[ref]: image.png "optional title" {#id .class key=val key2="val 2"}
- Block level: HTML
figure
element in MultiMarkdown @mmd @pandoc
-
This should *not* be markdown (or is it?)@markdown
-
This *is* markdown@mmd @pandoc(+markdown_attribute)
See more at Raw---MultiMarkdown Documentation. See test in [Babelmark 2 - Compare markdown implementations](http://johnmacfarlane.net/babelmark2/?normalize=1&text=%3Cdiv%3EThis+should+*not*+be+markdown+(or+is+it%3F%29+%3C%2Fdiv%3E%0A%3Cdiv+markdown%3D1%3EThis+*is*+markdown%3C%2Fdiv%3E).
- @mmd
- \newcommand\rawlatex{} @pandoc(parsed)
- \begin{...} @pandoc
Note: mmd accepts capitalized metadata keys but others do not. For maximum compatibility, author(s)
, title
, etc. should be in lower cases.
@mmd @pandoc(+mmd_title_block)
title: A Sample MultiMarkdown Document
author: Fletcher T. Penney
date: February 9, 2011
comment: This is a comment intended to demonstrate
metadata that spans multiple lines, yet
is treated as a single value.
CSS: http://example.com/standard.css
See more at Metadata---MultiMarkdown Documentation.
@pandoc
% title
% author(s) (separated by semicolons)
% date
@Mmd(partial)
@pandoc @ghpages
---
title: A Sample MultiMarkdown Document
author: Fletcher T. Penney
date: February 9, 2011
tags: [nothing, nothingness]
abstract: |
This is the abstract.
It consists of two paragraphs.
---
@pandoc
Use --toc
as a command argument.
@mmd
{{TOC}}
, see beginning. It preprocess the headings and generate a ToC on its own, and doesn't give instruction for LaTeX to generate one. A hack is like this:
---
...
LaTeX Input: mmd-load-toc-setcounter
LaTeX Input: mmd-load-toc
...
---
<!-- \begin{comment} -->
{{TOC}}
<!-- \end{comment} -->
...
See more at ickc/peg-multimarkdown-latex-support: Default support files for generating LaTeX documents with MMD 3 through MMD 5.
@ghpages
# Contents
{:.no_toc}
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
MathJax is assumed. MathJax has many configurable options. See MathJax TeX and LaTeX Support — MathJax 2.6 documentation.
@markdown
Add the following at the beginning of the document:
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full">
</script>
MathJax.js is used and any codes within math delimiters are treated as raw HTML and to be processed by MathJax.
MathJax delimiter are $$...$$
, \\(...\\)
and \\[...\\]
(because an extra \
can be used to escape from MarkDown).
Depending on the markdown parser, extra tricks might be needed to make sure nothing within the math delimiter is treated as markdown (see TeX and LaTeX in HTML documents — MathJax 2.6 documentation). $...$
can be used with MathJax configuration (see TeX and LaTeX math delimiters — MathJax 2.6 documentation).
There are subtleties how math should be used in HTML+MathJax and LaTeX output from single markdown source. See more in Testing LaTeX Environments Usage in MathJax From Markdown Conversion (including mmd and pandoc).
@mmd
Add the following metadata at the beginning of the document:
HTML header: <script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full">
</script>
MultiMarkdown math delimiter are $...$
, $$...$$
, \\(...\\)
and \\[...\\]
.
@pandoc(--mathjax)
For pandoc, add --mathjax
in the command-line argument.
Default math delimiter for pandoc is $...$
, $$...$$
. Other options are configurable. See more in Pandoc - Pandoc User’s Guide.
$1+1$ - \(1 + 1\) @pandoc(+tex_math_double_backslash)
$$R R^T = I$$ - \[A^T_S = B\]
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$ - $$
\begin{aligned}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy \end{aligned} $$ $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ - $$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \end{vmatrix}$$ $$P(E) = {n \choose k} p^k (1-p)^{n-k}$$ $$\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\ldots} } } }$$ - $$
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -, \frac1c, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}, +, \frac1c, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} $$ - $$1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
\prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},
\quad\quad \text{for
$|q|<1$ }.$$
@mmd
See more at File Transclusion---MultiMarkdown Documentation.
Some examples are directly or indirectly copied from the following documentations:
Footnotes
-
This is a footnote ↩
-
Here's one with multiple blocks.
Subsequent paragraphs are indented to show that they belong to the previous footnote.
{ some.code }
The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items. ↩
-
glossary: term (optional sort key) The actual definition belongs on a new line, and can continue on just as other footnotes. Note how it fallbacks gracefully in Markdown. ↩