Basic Syntax
#
HeadingsYou can use regular Markdown headings.
Markdown headings appear as a table-of-contents entry.
#
Heading idsEach heading has an id that can be automatically generated, or explicitly specified.
Heading ids allow you to link to a specific document heading in Markdown or JSX:
#
Generated idsBy default, Docusaurus will generate heading ids for you, based on the heading text.
### Hello World
will have id hello-world
.
Generated ids have some limits:
- The id might not look good
- You might want to change or translate the text without updating the existing id
#
Explicit idsA special Markdown syntax lets you set an explicit heading id:
tip
Use the write-heading-ids CLI command to add explicit ids to all your Markdown documents.
#
Table 表格This is a regular paragraph.
Foo |
This is another regular paragraph.
#
段落和空行 PARAGRAPHS AND LINE BREAKSA paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.
The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a <br />
tag.
When you do want to insert a <br />
break tag using Markdown, you end a line with two or more spaces, then type return.
Yes, this takes a tad more effort to create a <br />
, but a simplistic “every line break is a <br />
” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.
js后空行
<br />
标签和jsx代码间要空出一行!否则会报错:
Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>