Pandoc understands an extended and slightly version(变体) of Markdown syntax.This document explains the syntax, noting(注解) differrences from standard Markdown.Except where noted,these differences can be supperssed(抑制or禁止) by using the markdown_strict format instead markdown.An extensions(扩展) can be enabled(激活) by adding EXTENSION to the format name and disabled(关闭) by adding -EXTENSION.For example,markdown_strict+footnotes is strict(严谨的) Markdown with footnotes enabled,while markdown-footnote-pipe_tables is pandoc’s Markdown without footnotes or pipe tables.
Markdown is designed to be easy to write,and,even more importly,easy to read:
A Markdown-formatted document should be publishable as-is,as plain text,without looking like it’s been marked up with tags or formatting insructions. – John Gruber
This principle has guided pandoc’s decisions in finding syntax for tables,footnotes,and other extensions.
There is,however,one respect(一个方面) in which pandoc’s aims are different from the original aims of Markdown.Whereas Markdown was originally designed with HTML generation in mind,pandoc is designed for multiple output format,Thus,while pandoc allows the embedding of raw HTML,it discourages(阻碍) it,and provides other,non-HTMLish ways of representing important document elements like definition lists,tables,mathmatics,and footmotes.
A paragraph is one or more lines of text followed by one or more blank lines.Newlines are treated as spaces,so you can reflow your paragraph as you like.If you need a hard line break,put two or more spaces at the end of the line.
Extension:escaped_line_breaks
A backslash(反斜线) followed by a newline is also a hard line break,since trailing spaces in the cells are ignored.
There are two kinds of headers:Setext and ATX.
A setext-style header is a line of “underlined” with a row of =signs(for a level one header) or - signs(for a level two header):
A level-one header(with a row of =or add #) ===
-or add ##)An ATX-style header consists of one to six # signs and a line of text,optionally(可选择) by any number of # signs the number of # signs at the begining of the line is the header level.
As with setext-style headers,the header text can contain formatting:
# A level-one header with a [baidu](https://www.baidu.com/) and *emphasis*
: Extension:header_attributes
Header an assigned attributes(属性,特性) using this syntax at the end of the line containing the header text:
{#identfier .class .class key=value key=value}
Thus,for example,the following headers will be all be assigned the identifier(识别符)foo
# My header {#foo}
## My header ## {#foo}
My other header {#foo}
------
Note that although this syntax allows assignment(赋值) of classes and key//value attributes,writers generally don’t use all of this information.Identifiers,classes,and key//value attributes are used in HTML and HTML-based formats such as EPUB and slidy.identifiers are used for labels and link anchors(链接锚) in the LaTeX, ConTeXt, Textile, and AsciiDoc writers.
Headers with the class unnumbered(无编号) will not be unnumbered,even if--number-sections is specified(确定的).A single hyphen(-) in an attribute context is equivalent to .unnumbered,and preferable(更合适) in non-English document.So,
# My header {-}
is just the same as
# My header {.unnumberde}
is just the same as
: Extension:auto_identifiers
A header without an explicitly specified identifier will be automatically assigned a unique(唯一) based on the header text. To derive(得到,源于) the identifier from the header text,
section.Thus,for example,
| Header | Identifier |
|---|---|
Header indentifiers in HTML |
header-identifiers-in-html |
*Dogs*?--in *my* house? |
dog--in-my-house |
[HTML], [S5], or [RTF]? |
html-s5-or-rtf |
3.Applications |
applications |
33 |
section |
These rules should,in most case(往往),allow one to determine the identifier form the header text.The exception is when several headers have the same text;in this case,the first will get an identifier as described above;the second will get the same identifier with -1 appended;the third with-2;and so on.
These identifiers are uesd to provide link targets in the table of contents generated by the --toc|--table-of-contents option.They also make it easy to provide link from one section of a document to another,A link to this section,for example,might look like this:
See the section on
[header identifiers](#header-identifiers-in-html-latex-and-context).
See the section on header identifiers
Note, however, that this method of providing links to section work only in HTML, LaTeX, and ConTeXt formats.
--section-divs option is specified, then each section will be wrapped in a div (or a section, if --html5 was specified), and the identifier will be attached to the enclosing <div> (or <section>) tag rather than the header itself. This allows entire sections to be manipulated using javascript or treated differently in CSS.Extension: implicit_header_references
Pandoc behaves as if reference links have been difined for each header. So, to link to a header
# Header identifiers in HTML
you can simply write
[Header identifiers in HTML]
or
[Header identifiers in HTML] []
or
[the section on header identifiers] [header identifiers in HTML]
instead of giving the idenrifiers explicitly:
[Header identifiers in HTML](#header-identifiers-in-html)
If there are multiple headers with identical text, the corresponding reference will link to the first one only, and you will need to use explicit links to link to the others, as described above.
Like regular reference links, these references are case-insensitive.
Explicit link reference definitions always take priority over implicit header references. So, in the following example, the link will point to bar, not to #foo:
# Foo
[foo]: bar
See [foo]
See foo