Markdown 示例

24 年 4 月 1 日 星期一
618 字
4 分钟

下面是在 Astro 中编写 Markdown 内容时,可以使用的一些基本 Markdown 语法示例。

标题

你应该避免在 Markdown 正文中重复创建文章标题,因为文章标题会根据 frontmattertitle 自动生成。

避免标题层级过深,一般到三级标题就够了。

一级

二级

三级 inline code

四级

五级
六级

段落

Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.

使用行尾使用两个空格进行段落内的换行

All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.

图片

小尺寸的图片

图片描述

大尺寸的图片

图片描述

带标题的图片

图片描述
图片标题

强调

这是重要内容,这是次要内容

删除线

这是一段被删除的文本。

引用

The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.

Tiam, ad mint andaepu dandae nostion secatur sequo quae.
Note that you can use Markdown syntax within a blockquote.

嵌套的引用

引用

嵌套的引用

带脚标的引用

Don't communicate by sharing memory, share memory by communicating.
Rob Pike1

分割线


链接

这是内部链接 使用指南

这是外部连接 React 中文文档

自动渲染成连接 https://www.baidu.com

邮箱地址 mail@example.com

表格

ItalicsBoldCode
italicsboldcode

代码块

Syntax

we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntac, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash

html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Example HTML5 Document</title>
  </head>
  <body>
    <p>Test</p>
  </body>
</html>
text
const var text = "hello world"

List Types

Ordered List

Syntax

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

Output

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

Unordered List

Syntax

markdown
- List item
- Another item
- And another item

Output

  • List item
  • Another item
  • And another item

Nested list

Syntax

markdown
- Fruit
  - Apple
  - Orange
  - Banana
- Dairy
  - Milk
  - Cheese

Output

  • Fruit
    • Apple
    • Orange
    • Banana
  • Dairy
    • Milk
    • Cheese

Other Elements — abbr, sub, sup, kbd, mark

Syntax

markdown
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.

H<sub>2</sub>O

X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>

Press <kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd></kbd> to end the session.

Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.

Output

GIF is a bitmap image format.

H2O

Xn + Yn = Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

参考

  1. The above quote is excerpted from Rob Pike's talk during Gopherfest, November 18, 2015.