开放 API 现已上线。通过 API 将 Markdown 转换为图片,每月 50 次带水印免费调用。

参考

Markdown 速查表

你需要的每一条 Markdown 语法,左边是写法,右边是渲染效果。涵盖 CommonMark 与 GitHub Flavored Markdown 扩展。

标题

共六级。标题前留一个空行,否则可能被上一段吞掉。

一级标题

# Heading level 1

Heading level 1

章节标题

## Heading level 2

Heading level 2

小节标题

### Heading level 3

Heading level 3

一、二级标题的另一种写法

Heading level 1
===============

Heading level 2
---------------

Heading level 1

Heading level 2

强调

星号和下划线都可以用。在单词内部用星号更保险。

粗体

**bold text**
bold text

斜体

*italic text*
italic text

粗斜体

***bold and italic***
bold and italic

删除线(GFM)

~~struck through~~
struck through

列表

缩进两个空格即可嵌套。有序列表会自动重新编号,所以全部写 1. 也没问题。

无序列表

- First item
- Second item
- Third item
  • First item
  • Second item
  • Third item

有序列表

1. First item
1. Second item
1. Third item
  1. First item
  2. Second item
  3. Third item

嵌套列表

- Parent item
  - Child item
    - Grandchild item
  • Parent item
    • Child item
      • Grandchild item

任务列表(GFM)

- [x] Finished task
- [ ] Open task
  • xFinished task
  • Open task

图片就是前面加一个感叹号的链接。alt 文本对无障碍和 SEO 都有用。

行内链接

[Markdown to Image](https://markdowntoimage.com)
Markdown to Image

带悬停标题的链接

[Markdown to Image](https://markdowntoimage.com "Convert Markdown")
Markdown to Image

图片

![A mountain at dusk](/photo.jpg)
A mountain at dusk

自动链接

<https://markdowntoimage.com>
https://markdowntoimage.com

代码

在起始围栏后写上语言名,就能获得语法高亮。

行内代码

Run `npm install` first.
Run npm install first.

围栏代码块

```
plain code block
```
plain code block

带高亮的代码块

```js
const total = items.length;
```
const total = items.length;

引用

引用里可以嵌套任何其他 Markdown,包括列表和代码。

引用块

> Everything should be made as
> simple as possible.
Everything should be made as simple as possible.

嵌套引用

> Outer quote
>
>> Inner quote
Outer quote
Inner quote

表格

源码里的竖线不需要对齐。分隔行里的冒号用来设置对齐方式。

基础表格

| Format | Size |
| --- | --- |
| PNG | 240 KB |
| PDF | 96 KB |
FormatSize
PNG240 KB
PDF96 KB

列对齐

| Left | Center | Right |
| :--- | :----: | ----: |
| a | b | c |
LeftCenterRight
abc

其他语法

三个及以上的短横线构成分割线。行尾加两个空格可以强制换行而不新起段落。

分割线

---

强制换行

First line ends here.\
Second line starts here.
First line ends here.
Second line starts here.

转义特殊字符

\*not italic\*
*not italic*

脚注(GFM)

Text with a note.[^1]

[^1]: The note itself.
Text with a note.1

常见问题

技术支持
Q1

Markdown 和 GitHub Flavored Markdown 有什么区别?

GitHub Flavored Markdown(GFM)是 CommonMark 的超集,额外提供表格、任务列表、删除线、脚注和自动链接。本页标注 GFM 的语法需要渲染器支持这些扩展——现在大多数渲染器都支持。
Q2

为什么我的标题没有渲染出来?

最常见的原因是井号后面漏了空格,要写 # 标题,而不是 #标题。其次是标题上方没有空行,部分解析器会把它当成上一段的一部分。
Q3

怎样换行但不新起一个段落?

在行尾加两个空格,或者在行尾加一个反斜杠。大多数解析器会把单个换行折叠成空格,而空行则会直接开启新段落。
Q4

怎样显示星号或下划线本身?

在前面加一个反斜杠。写 \*文字\* 会渲染成 *文字*,而不会变成斜体。反引号、井号、方括号等 Markdown 字符同理。
Q5

Markdown 表格的列需要对齐吗?

不需要。源码里的竖线不必对齐,渲染器会自行处理排版;对齐只是让原始文件更好读。真正起作用的是表头下面的分隔行。
Markdown 速查表 | 完整语法参考 | MarkdownToImage