Markdown is a lightweight markup language created by John Gruber in 2004. It allows people to write documents in an easy-to-read and easy-to-write plain text format. With a suitable converter, documents written in Markdown can be exported to HTML, Word, images, PDF, EPUB, and other formats. Markdown documents usually use the extensions .md or .markdown.
Markdown Applications
Markdown can be used to write e-books with tools such as GitBook.
Many websites use Markdown for documentation or forum posts, including GitHub, Jianshu, Reddit, Diaspora, Stack Exchange, OpenStreetMap, and SourceForge.
Markdown Basics
Headings
Markdown headings have two formats.
1. Use = and - to mark first-level and second-level headings
Markdown
这是H1的标题
===========
这是H2的标题
-----------
2. Use # as a marker
Use # to represent headings of levels 1-6, where a level-one heading corresponds to one # and a level-two heading corresponds to two # and so on.
Markdown paragraphs need no special formatting; just write your text. To insert a line break within a paragraph, end the line with two or more spaces and press Enter.
A blank line separates two paragraphs.
Italics and Bold
Markdown uses *text* or _text_ for italic text, and **text** or __text__ for bold text.
Usage
Result
*italic text*
italic text
_italic text_
italic text
**bold text**
bold text
__bold text__
bold text
***bold italic text***
bold italic text
___bold italic text___
bold italic text
Lists
Markdown supports unordered and ordered lists.
Unordered List
Unordered lists use an asterisk *or a plus + or a minus - as a list marker. Add a space after the marker, then the list item text:
Markdown uses many special symbols to represent specific meanings. If you need to display a specific symbol, you must use an escape character. Markdown uses a backslash to escape special characters:
Markdown
**文本加粗**
\*\* 正常显示星号 \*\*
Markdown supports adding a backslash before the following symbols to help insert ordinary symbols:
Markdown
Markdown Applications
Markdown can be used to write e-books with tools such as GitBook.
Many websites use Markdown for documentation or forum posts, including GitHub, Jianshu, Reddit, Diaspora, Stack Exchange, OpenStreetMap, and SourceForge.
Markdown Basics
Headings
Markdown headings have two formats.
1. Use = and - to mark first-level and second-level headings
2. Use # as a marker
Use # to represent headings of levels 1-6, where a level-one heading corresponds to one # and a level-two heading corresponds to two # and so on.
Paragraphs
Markdown paragraphs need no special formatting; just write your text. To insert a line break within a paragraph, end the line with two or more spaces and press Enter.
A blank line separates two paragraphs.
Italics and Bold
Markdown uses *text* or _text_ for italic text, and **text** or __text__ for bold text.
Usage
Result
*italic text*
italic text
_italic text_
italic text
**bold text**
bold text
__bold text__
bold text
***bold italic text***
bold italic text
___bold italic text___
bold italic text
Lists
Markdown supports unordered and ordered lists.
Unordered List
Unordered lists use an asterisk * or a plus + or a minus - as a list marker. Add a space after the marker, then the list item text:
Ordered List
Ordered lists are represented by numbers followed by a period, for example:
Nested Lists
To nest lists, simply add four spaces before the items in the sublist:
Blockquotes
Markdown blockquotes use the > marker at the beginning of a paragraph, followed by a space:
In addition, blockquotes can be nested. One > symbol is the outermost level, two > symbols are the first level of nesting, and so on:
Using Lists in Blockquotes
Using Blockquotes in Lists
Code
Wrap a function name or code fragment in backticks `, for example `code`. To display the function name printf(), write:
Code Blocks
Indent a code block with four spaces or one tab.
The result is displayed as follows:
$(document).ready(function () {
alert('RUNOOB');
});
You can also use ``` around a code block, with an optional language identifier:
The result is displayed as follows:
Links
Links are used as follows:
For example:
This is a link Brian's Blog
Using a Link Address Directly
Link <https://xxxbrian.me>
Advanced Links
Reference-style links let you define a URL separately, usually at the end of the document:
Images
The Markdown image syntax is as follows:
Usage example:
Tables
To create a table in Markdown, use | to separate different cells, and use - to separate the header from other rows.
Table Alignment
Escaping Special Characters
Markdown uses many special symbols to represent specific meanings. If you need to display a specific symbol, you must use an escape character. Markdown uses a backslash to escape special characters:
Markdown supports adding a backslash before the following symbols to help insert ordinary symbols: