今天看啥  ›  专栏  ›  cc阴天

markdown语法

cc阴天  · 简书  ·  · 2020-10-31 23:55

一:标题 1:Setext格式(= and -)

H1

H2

PS: = 和 - 的长度是没有限制的,最好和标题文本长度一样,看起来舒服,且可以像我一样,用4个,Setext支持H1,H2两种标题

2:atx格式

1: 用对称的####

####5####

2: 只在左边使用#

####5 3: 对称的#或者只有左边的#不可以有任何空白,但是内侧可以有空白

####557####   ####5 5 7 ####

PS: 这一点上各种markdown可能会有所不同,但是都要遵循语法规则。

二:段落与换行

1: 段落前后必须是空行,空行指行内什么都没有,或者只有空白符。相邻的两行文本,如果中间没有空行,会显示在一行中(换行符会被转换为空格) 2: 如果段落内需要换行,加入<br,补一个> 效果大概就是 这样 3:Markdown中的多数区块都需要在两个空行之间

三:引用 1: 引用内容   再段落前或者其他内容前使用 > 符号,就可以将内容视为引用。

势力引用

2: 多行引用

第一行

第二行,可以每一行都加>

第一行

第二行,也可以一个>,后面的可以省略>

第一行

第二行

第四行,空白行,可以打一些空白内容,然后回车,也可以直接拍打两个空格(typora没有生效)

3: 嵌套引用

第一行

第二行——第一行使用一个>,第二行使用两个>>

4:使用中可以使用其他markdown语法

" 第一行 "

PS: 想要退出引用,两次回车即可退出引用编辑模式。

四:列表 1: 无序列表

  • 第一个标志 *

  • 第二个标志 -

  • 第三个标志 +

2:有序列表

  1. 第一个标志——1.+空格+内容(空格如果有多个,也会被分析为一个空格)

  2. 第二个标志,同上

  3. 第三个标志,直接回车,接上面的顺序往下。

3:嵌套的列表

  1. 第一行

    • 1-1

    • 1-2

  • 第二行

    1. 2-1

    2. 2-2

Ps:所以有序和无需的相互嵌套是随意用的。

4:取消为列表 数字+ \ + .(中间没有空格,连续的,我是为了让他们显示出来) 7. 哦豁,giao—— \ + . 模式

  1. 哦豁,giao—— .模式

五:代码 1: 代码块 可以使用缩进来插入代码块:代码块前后需要一个空行,且每行代码需要一个TAB或者四个空格(别问,问就是规范)。

<html>

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n571" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><title>1111</title></pre>

</html> 2:行内代码 通过``插入行内代码,就是Tab上面,英文状态下的那个~下面的标志符(行内代码块其实挺好用的)。

比如说 好想起飞啊,我giao

六:分隔线 1: 可以在一行中使用三个或者更多的 * , - , _ ,来添加分割线 <hr>




PS:以上三种标志都可,且三个连续标志之间可以有空格,但是不可以有其他字符或者内容。

七:超链接 1: 行内式 格式为 [link text](URL "title text") 百度 2:参考式 格式为 [link text]:(URL "title text")

[baidu] www.baidu.com

3:自动连接 : 使用<>包括在内的URL或者邮箱自动被转为超链接 www.baidu.com

八:图片 和超链接基本相同,就是两者相差一个了 ! ,且放在开头

1: 参考式格式: ![图片名称](URL地址) 实例:本人近期的运动图

图片实例

2: 指定图片大小 格式: 实例:

实例

PS: style:"zoom : 50" 就是让大小是以前的50% 3:参考式 和超链接一毛一样,大家自己试一下吧。

九:强调(符号都需成对使用) 1: · 使用* *或者_ _ 包含的文件会被转换为<em></em> 实例: 111 222 333 PS:用来文本的 或者_的内侧不可有空白,不然会成为 _ 文本 _ (毫无变化) 2:使用 ** ** 或者 __ __包含的文本会被转换为<strong> </strong> 实例: 111 * 222 333 3:如果需要显示成対的 * 或者 _,在符号前加入 \ 实例 演示 (会显示出来)

十:转义字符 其实就是 \ ,这个在markdown中是特殊的转义字符,大家自行探索,代码中用到倒是挺多的。

以下为拓展语法,不同的平台支持的方式不同。

一:删除线 格式 ~~内容~~ 实例 giao

二:代码块和语法高亮 1: 代码块 格式: <p> code </p> 实例:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n853" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">code</pre>

PS:```` 要独占一行`

2: 代码高亮 在上面代码基础块的语法上在````后面加上js` 实例:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="js" cid="n869" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">window.add()</pre>

3: 表格 格式:

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="markdown" cid="n970" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; margin-top: 0px; margin-bottom: 20px; font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; white-space: normal; background: rgb(51, 51, 51); position: relative !important; padding: 10px 10px 10px 30px; width: inherit; color: rgb(184, 191, 198); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">| name | age |
| ---------- | --- |
| LearnShare | 12 |
| Mike | 32 |</pre>

PS1:+ :--- 代表左对齐 + :--: 代表居中对齐 + ---: 代表右对齐 PS2:内容可以加入超链接等内容




原文地址:访问原文地址
快照地址: 访问文章快照