markdown语法——引用链接、脚注、内嵌HTML标签

1. 引用链接

引用样式链接是一种特殊的链接,它使 URL 在 Markdown 中更易于显示和阅读。

[hobbit-hole] [tag]

[tag]: 网址
[tag]: 网址 "标题"
[tag]: 网址 '标题'
[tag]: 网址 (标题)
[tag]: <网址> "标题"
[tag]: <网址> '标题'
[tag]: <网址> (标题)

渲染后效果:
[hobbit-hole] tag

参考样式链接分为两部分:与文本保持内联的部分以及存储在文件中其他位置的部分,以使文本易于阅读。

  • 第一部分
    • 使用两组括号进行格式设置。第一组方括号包围应显示为链接的文本。第二组括号显示了一个标签,该标签用于指向您存储在文档其他位置的链接。
    • 第一组和第二组括号之间空格可以省略
    • 第二组括号中的标签不区分大小写,可以包含字母,数字,空格或标点符号。
  • 第二部分
    • 放在括号中的标签,其后紧跟一个冒号和至少一个空格(例如[label]:)。
    • 链接的URL,可以选择将其括在尖括号中。
    • 链接的可选标题,可以将其括在双引号,单引号或括号中。

可以将链接的第二部分放在Markdown文档中的任何位置。有些人将它们放在出现的段落之后,有些人则将它们放在文档的末尾(例如尾注或脚注)。

2. 脚注

脚注的注释部分放在md文档哪里都可以,但渲染之后会统一显示在文档末尾。

Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.
[^bignote]: Here's one with multiple paragraphs and code.
    Indent paragraphs to include them in the footnote.
    `{ my code }`
    Add as many paragraphs as you like.

Here’s a simple footnote,1 and here’s a longer one.2

3. 内嵌HTML标签

  • 行级内联标签:如<span><cite><del>等不受限制,可以在 Markdown 的段落、列表或是标题里任意使用
  • 区块标签:如<div><table><pre><p>等标签
    • 必须在前后加上空行,以便于内容区分
    • 这些元素的开始与结尾标签,不可以用tab或空白缩进
    • Markdown会自动识别这区块元素,避免在区块标签前后加上没有必要的<p>标签
    • Markdown 语法在HTML区块标签中将不会被进行处理

  1. This is the first footnote. ↩︎

  2. Here’s one with multiple paragraphs and code.
    Indent paragraphs to include them in the footnote.
    { my code }
    Add as many paragraphs as you like. ↩︎

猜你喜欢

转载自blog.csdn.net/guanxxx/article/details/138813822