GFMDescription.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <!DOCTYPE html>
  2. <html class="theme">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>GFM基础书写格式</title>
  7. <link id="prettify-style" href="./prettify-cmd.css" type="text/css" rel="stylesheet">
  8. </head>
  9. <body style="width:1200px;margin:0 auto;">
  10. <!-- zybuluo's body -->
  11. <!-- mdeditor's body -->
  12. <div id="editor-reader-full" class="editor-reader-full-shown" style="position: static;">
  13. <div id="wmd-preview" class="wmd-preview wmd-preview-full-reader">
  14. <div class="md-section-divider"></div>
  15. <p data-anchor-id="vpmx">GFM 是 Github 拓展的基于 Markdown 的一种纯文本的书写格式。</p>
  16. <div class="md-section-divider"></div>
  17. <h2 data-anchor-id="0op9" id="基础书写格式">基础书写格式</h2>
  18. <div class="md-section-divider"></div>
  19. <h3 data-anchor-id="q2cg" id="段落">段落</h3>
  20. <p data-anchor-id="sbds">在 Markdown 中,连续的一行或多行就是一个段落。用空行来进行切段。</p>
  21. <div class="md-section-divider"></div>
  22. <pre class="prettyprint linenums prettyprinted" data-anchor-id="6pb4" style=""><ol class="linenums">
  23. <li class="L0"><code class="language-gfm"><span class="pun">这是第一个段落</span></code></li>
  24. <li class="L1"><code class="language-gfm"><span class="pun">我跟上面是同一个段落</span></code></li>
  25. <li class="L2"><code class="language-gfm"></code></li>
  26. <li class="L3"><code class="language-gfm"><span class="pun">这是第二个段落</span></code></li>
  27. </ol></pre>
  28. <div class="md-section-divider"></div>
  29. <h3 data-anchor-id="citx" id="大纲">大纲</h3>
  30. <p data-anchor-id="9atw">Markdown 中,使用 <code>#</code> 来定义大纲标题,有多少个 <code>#</code>,就表示是几级的大纲。比如:</p>
  31. <div class="md-section-divider"></div>
  32. <pre class="prettyprint linenums prettyprinted" data-anchor-id="92o3" style=""><ol class="linenums">
  33. <li class="L0"><code class="language-gfm"><span class="com"># 这是一级标题(会生成&lt;h1&gt;标签)</span></code></li>
  34. <li class="L1"><code class="language-gfm"></code></li>
  35. <li class="L2"><code class="language-gfm"><span class="pun">这里是段落内容</span></code></li>
  36. <li class="L3"><code class="language-gfm"></code></li>
  37. <li class="L4"><code class="language-gfm"><span class="com">## 这里是二级标题(会生成&lt;h2&gt;标签)</span></code></li>
  38. <li class="L5"><code class="language-gfm"></code></li>
  39. <li class="L6"><code class="language-gfm"><span class="pun">这里是段落内容</span></code></li>
  40. <li class="L7"><code class="language-gfm"></code></li>
  41. <li class="L8"><code class="language-gfm"><span class="pun">...</span></code></li>
  42. <li class="L9"><code class="language-gfm"></code></li>
  43. <li class="L0"><code class="language-gfm"><span class="com">###### 这里是六级标题</span></code></li>
  44. </ol></pre>
  45. <p data-anchor-id="upfh">这种书写方式非常直观自然。</p>
  46. <div class="md-section-divider"></div>
  47. <h3 data-anchor-id="7nka" id="引用内容">引用内容</h3>
  48. <p data-anchor-id="md05">引用部分的内容只需要在行首加上 <code>&gt;</code> 就可以了。比如:</p>
  49. <div class="md-section-divider"></div>
  50. <pre class="prettyprint linenums prettyprinted" data-anchor-id="2apm" style=""><ol class="linenums">
  51. <li class="L0"><code class="language-gfm"><span class="pun">&gt;</span><span class="pln"> </span><span
  52. class="typ">To</span><span class="pln"> be </span><span class="kwd">or</span><span
  53. class="pln"> </span><span class="kwd">not</span><span class="pln"> to be</span><span
  54. class="pun">,</span><span class="pln"> that </span><span class="kwd">is</span><span class="pln"> a question</span><span
  55. class="pun">.</span></code></li>
  56. </ol></pre>
  57. <p data-anchor-id="yi40">看起来是这样的:</p>
  58. <blockquote data-anchor-id="rcsg" class="white-blockquote">
  59. <p>To be or not to be, that is a question.</p>
  60. </blockquote>
  61. <div class="md-section-divider"></div>
  62. <h3 data-anchor-id="ca9i" id="强调文本">强调文本</h3>
  63. <p data-anchor-id="mmaq">您可以使用<strong>加粗</strong>和<em>斜体</em>来格式化文本内容。</p>
  64. <div class="md-section-divider"></div>
  65. <pre class="prettyprint linenums prettyprinted" data-anchor-id="uxo1" style=""><ol class="linenums">
  66. <li class="L0"><code class="language-gfm"><span class="pun">加粗使用:</span><span class="pln"> </span><span
  67. class="pun">**这种语法**</span></code></li>
  68. <li class="L1"><code class="language-gfm"><span class="pun">斜体使用:</span><span class="pln"> </span><span
  69. class="pun">*这种语法*</span><span class="pln"> </span><span class="pun">或</span><span
  70. class="pln"> _</span><span class="pun">这种语法</span><span class="pln">_</span></code></li>
  71. <li class="L2"><code class="language-gfm"><span class="pun">还可以混合使用:**加粗文本中的</span><span
  72. class="pln">_</span><span class="pun">斜体</span><span class="pln">_</span><span class="pun">**</span></code>
  73. </li>
  74. </ol></pre>
  75. <div class="md-section-divider"></div>
  76. <h3 data-anchor-id="tg2m" id="删除线">删除线</h3>
  77. <p data-anchor-id="r07a">你可以使用 ~~ 包裹一段文本让它拥有
  78. <del>删除效果</del>
  79. </p>
  80. <div class="md-section-divider"></div>
  81. <pre class="prettyprint linenums prettyprinted" data-anchor-id="lgdz" style=""><ol class="linenums">
  82. <li class="L0"><code class="language-gfm"><span class="pun">这样来~~删除一段文本~~</span></code></li>
  83. </ol></pre>
  84. <div class="md-section-divider"></div>
  85. <h2 data-anchor-id="nmhu" id="超链接">超链接</h2>
  86. <p data-anchor-id="gnhz">通过 <code>[文本](url)</code> 的形式来添加超链接。比如这个是一个<a href="http://www.o2oa.net"
  87. target="_blank">O2官网</a>的超连接。</p>
  88. <div class="md-section-divider"></div>
  89. <pre class="prettyprint linenums prettyprinted" data-anchor-id="y8kn" style=""><ol class="linenums">
  90. <li class="L0"><code><span class="pun">[2官网](</span><span class="pln">http</span><span class="pun">:</span><span
  91. class="com">//o2oa.net) - 活力办公,创意无限</span></code></li>
  92. </ol></pre>
  93. <div class="md-section-divider"></div>
  94. <h2 data-anchor-id="z94z" id="列表">列表</h2>
  95. <div class="md-section-divider"></div>
  96. <h3 data-anchor-id="rrgr" id="无序列表">无序列表</h3>
  97. <p data-anchor-id="s7fo">在行首添加 <code>*</code> 或 <code>-</code> 可以开启列表模式,比如</p>
  98. <div class="md-section-divider"></div>
  99. <pre class="prettyprint linenums prettyprinted" data-anchor-id="pptp" style=""><ol class="linenums">
  100. <li class="L0"><code class="language-gfm"><span class="pun">*</span><span class="pln"> </span><span
  101. class="pun">第一,...</span></code></li>
  102. <li class="L1"><code class="language-gfm"><span class="pun">*</span><span class="pln"> </span><span
  103. class="pun">第二,...</span></code></li>
  104. <li class="L2"><code class="language-gfm"><span class="pun">*</span><span class="pln"> </span><span
  105. class="pun">第三,...</span></code></li>
  106. <li class="L3"><code class="language-gfm"></code></li>
  107. <li class="L4"><code class="language-gfm"><span class="pun">-</span><span class="pln"> </span><span
  108. class="pun">首先,...</span></code></li>
  109. <li class="L5"><code class="language-gfm"><span class="pun">-</span><span class="pln"> </span><span
  110. class="pun">其次,...</span></code></li>
  111. <li class="L6"><code class="language-gfm"><span class="pun">-</span><span class="pln"> </span><span
  112. class="pun">最后,...</span></code></li>
  113. </ol></pre>
  114. <div class="md-section-divider"></div>
  115. <h3 data-anchor-id="hlrd" id="有序列表">有序列表</h3>
  116. <p data-anchor-id="xc8d">在行首添加数字,就可以开启有序列表模式,比如:</p>
  117. <div class="md-section-divider"></div>
  118. <pre class="prettyprint linenums prettyprinted" data-anchor-id="qdfd" style=""><ol class="linenums">
  119. <li class="L0"><code class="language-gfm"><span class="lit">1.</span><span class="pln"> </span><span
  120. class="pun">打开冰箱</span></code></li>
  121. <li class="L1"><code class="language-gfm"><span class="lit">2.</span><span class="pln"> </span><span
  122. class="pun">把大象放进去</span></code></li>
  123. <li class="L2"><code class="language-gfm"><span class="lit">3.</span><span class="pln"> </span><span
  124. class="pun">关上冰箱</span></code></li>
  125. </ol></pre>
  126. <div class="md-section-divider"></div>
  127. <h3 data-anchor-id="l9ci" id="列表嵌套">列表嵌套</h3>
  128. <p data-anchor-id="hh4i">在上一级列表的基础上加两个空格,即可嵌套列表</p>
  129. <div class="md-section-divider"></div>
  130. <pre class="prettyprint linenums prettyprinted" data-anchor-id="54pb" style=""><ol class="linenums">
  131. <li class="L0"><code class="language-gfm"><span class="lit">1.</span><span class="pln"> </span><span
  132. class="pun">打开冰箱</span></code></li>
  133. <li class="L1"><code class="language-gfm"><span class="pln"> </span><span class="lit">1.</span><span
  134. class="pln"> </span><span class="pun">用右手打开</span></code></li>
  135. <li class="L2"><code class="language-gfm"><span class="pln"> </span><span class="lit">2.</span><span
  136. class="pln"> </span><span class="pun">轻轻地打开</span></code></li>
  137. <li class="L3"><code class="language-gfm"><span class="lit">2.</span><span class="pln"> </span><span
  138. class="pun">把大象放进去</span></code></li>
  139. <li class="L4"><code class="language-gfm"><span class="pln"> </span><span class="pun">*</span><span
  140. class="pln"> </span><span class="pun">不要吐槽</span></code></li>
  141. <li class="L5"><code class="language-gfm"><span class="pln"> </span><span class="pun">*</span><span
  142. class="pln"> </span><span class="pun">大象太大</span></code></li>
  143. <li class="L6"><code class="language-gfm"><span class="pln"> </span><span class="pun">*</span><span
  144. class="pln"> </span><span class="pun">冰箱太小</span></code></li>
  145. <li class="L7"><code class="language-gfm"><span class="pln"> </span><span class="pun">*</span><span
  146. class="pln"> </span><span class="pun">例子很无聊</span></code></li>
  147. <li class="L8"><code class="language-gfm"><span class="lit">3.</span><span class="pln"> </span><span
  148. class="pun">关上冰箱</span></code></li>
  149. </ol></pre>
  150. <p data-anchor-id="zbwc">整体效果:</p>
  151. <blockquote data-anchor-id="0zo2" class="white-blockquote">
  152. <ol>
  153. <li>打开冰箱 <br>
  154. <ol>
  155. <li>用右手打开</li>
  156. <li>轻轻地打开</li>
  157. </ol>
  158. </li>
  159. <li>把大象放进去 <br>
  160. <ul>
  161. <li>不要吐槽</li>
  162. <li>大象太大</li>
  163. <li>冰箱太小</li>
  164. <li>例子很无聊</li>
  165. </ul>
  166. </li>
  167. <li>关上冰箱</li>
  168. </ol>
  169. </blockquote>
  170. <div class="md-section-divider"></div>
  171. <h2 data-anchor-id="h26m" id="表格">表格</h2>
  172. <p data-anchor-id="auai">表格使用了直观的定义方式,使用 <code>-</code> 和 <code>|</code> 分割行和列。</p>
  173. <div class="md-section-divider"></div>
  174. <pre class="prettyprint linenums prettyprinted" data-anchor-id="1bjw" style=""><ol class="linenums">
  175. <li class="L0"><code class="language-gfm"><span class="pun">月份|收入|支出</span></code></li>
  176. <li class="L1"><code class="language-gfm"><span class="pun">----|----|---</span></code></li>
  177. <li class="L2"><code class="language-gfm"><span class="lit">8</span><span class="pln"> </span><span
  178. class="pun">|</span><span class="lit">1000</span><span class="pun">|</span><span
  179. class="lit">500</span></code></li>
  180. <li class="L3"><code class="language-gfm"><span class="lit">9</span><span class="pln"> </span><span
  181. class="pun">|</span><span class="lit">1200</span><span class="pun">|</span><span
  182. class="lit">600</span></code></li>
  183. <li class="L4"><code class="language-gfm"><span class="lit">10</span><span class="pln"> </span><span
  184. class="pun">|</span><span class="lit">1400</span><span class="pun">|</span><span
  185. class="lit">650</span></code></li>
  186. </ol></pre>
  187. <p data-anchor-id="jgya">看起来效果如下:</p>
  188. <table data-anchor-id="1nfi" class="table table-striped-white table-bordered">
  189. <thead>
  190. <tr>
  191. <th>月份</th>
  192. <th>收入</th>
  193. <th>支出</th>
  194. </tr>
  195. </thead>
  196. <tbody>
  197. <tr>
  198. <td>8</td>
  199. <td>1000</td>
  200. <td>500</td>
  201. </tr>
  202. <tr>
  203. <td>9</td>
  204. <td>1200</td>
  205. <td>600</td>
  206. </tr>
  207. <tr>
  208. <td>10</td>
  209. <td>1400</td>
  210. <td>650</td>
  211. </tr>
  212. </tbody>
  213. </table>
  214. <p data-anchor-id="ff3k">其中,航标题后的一行使用的横杆数量是不要求的,只是为了排版好看才人工对齐。比如你可以这样来定义上述表格。</p>
  215. <div class="md-section-divider"></div>
  216. <pre class="prettyprint linenums prettyprinted" data-anchor-id="js9l" style=""><ol class="linenums">
  217. <li class="L0"><code class="language-gfm"><span class="pun">月份|收入|之处</span></code></li>
  218. <li class="L1"><code class="language-gfm"><span class="pun">-|-|-</span></code></li>
  219. <li class="L2"><code class="language-gfm"><span class="lit">8</span><span class="pun">|</span><span
  220. class="lit">1000</span><span class="pun">|</span><span class="lit">500</span></code></li>
  221. <li class="L3"><code class="language-gfm"><span class="lit">9</span><span class="pun">|</span><span
  222. class="lit">1200</span><span class="pun">|</span><span class="lit">600</span></code></li>
  223. <li class="L4"><code class="language-gfm"><span class="lit">10</span><span class="pun">|</span><span
  224. class="lit">1400</span><span class="pun">|</span><span class="lit">650</span></code></li>
  225. </ol></pre>
  226. <p data-anchor-id="t5yx">你还可以使用 <code>:</code> 指定列的对齐方式。</p>
  227. <div class="md-section-divider"></div>
  228. <pre class="prettyprint linenums prettyprinted" data-anchor-id="rfs0" style=""><ol class="linenums">
  229. <li class="L0"><code class="language-gfm"><span class="pun">月份(居中对齐)|收入(右对齐)|支出(左对齐)</span></code></li>
  230. <li class="L1"><code class="language-gfm"><span
  231. class="pun">:--------------:|-------------:|:------------</span></code></li>
  232. <li class="L2"><code class="language-gfm"><span class="lit">8</span><span class="pln"> </span><span
  233. class="pun">|</span><span class="lit">1000</span><span class="pln"> </span><span
  234. class="pun">|</span><span class="lit">500</span></code></li>
  235. <li class="L3"><code class="language-gfm"><span class="lit">9</span><span class="pln"> </span><span
  236. class="pun">|</span><span class="lit">1200</span><span class="pln"> </span><span
  237. class="pun">|</span><span class="lit">600</span></code></li>
  238. <li class="L4"><code class="language-gfm"><span class="lit">10</span><span class="pln"> </span><span
  239. class="pun">|</span><span class="lit">1400</span><span class="pln"> </span><span
  240. class="pun">|</span><span class="lit">650</span></code></li>
  241. </ol></pre>
  242. <p data-anchor-id="hk7m">看起来效果如下:</p>
  243. <table data-anchor-id="7col" class="table table-striped-white table-bordered">
  244. <thead>
  245. <tr>
  246. <th style="text-align:center;">月份(居中对齐)</th>
  247. <th style="text-align:right;">收入(右对齐)</th>
  248. <th style="text-align:left;">支出(左对齐)</th>
  249. </tr>
  250. </thead>
  251. <tbody>
  252. <tr>
  253. <td style="text-align:center;">8</td>
  254. <td style="text-align:right;">1000</td>
  255. <td style="text-align:left;">500</td>
  256. </tr>
  257. <tr>
  258. <td style="text-align:center;">9</td>
  259. <td style="text-align:right;">1200</td>
  260. <td style="text-align:left;">600</td>
  261. </tr>
  262. <tr>
  263. <td style="text-align:center;">10</td>
  264. <td style="text-align:right;">1400</td>
  265. <td style="text-align:left;">650</td>
  266. </tr>
  267. </tbody>
  268. </table>
  269. <div class="md-section-divider"></div>
  270. <h2 data-anchor-id="sb2h" id="代码">代码</h2>
  271. <div class="md-section-divider"></div>
  272. <h3 data-anchor-id="6qcb" id="行内代码">行内代码</h3>
  273. <p data-anchor-id="pp5g">在文本中使用 <code>`</code> 包裹的内容会被识别为代码,比如</p>
  274. <div class="md-section-divider"></div>
  275. <pre class="prettyprint linenums prettyprinted" data-anchor-id="3tlj" style=""><ol class="linenums">
  276. <li class="L0"><code class="language-gfm"><span class="pun">现在你可以不用</span><span class="pln"> </span><span
  277. class="str">`document.getElementById()`</span><span class="pln"> </span><span class="pun">了,现代浏览器都把复制了</span><span
  278. class="pln"> </span><span class="str">`id`</span><span class="pln"> </span><span class="pun">属性的元素放在了全局变量里。</span></code>
  279. </li>
  280. </ol></pre>
  281. <p data-anchor-id="02kr">渲染出来是:</p>
  282. <blockquote data-anchor-id="1e9m" class="white-blockquote">
  283. <p>现在你可以不用 <code>document.getElementById()</code> 了,现代浏览器都把复制了 <code>id</code> 属性的元素放在了全局变量里。</p>
  284. </blockquote>
  285. <div class="md-section-divider"></div>
  286. <h3 data-anchor-id="44wd" id="多行代码">多行代码</h3>
  287. <p data-anchor-id="d74q">使用 <code>```</code> 来包裹多行的内容成为代码。</p>
  288. <p data-anchor-id="ux7c">比如:</p>
  289. <div class="md-section-divider"></div>
  290. <pre class="prettyprint linenums prettyprinted" data-anchor-id="6urz" style=""><ol class="linenums">
  291. <li class="L0"><code><span class="pln"> </span><span class="str">```</span></code></li>
  292. <li class="L1"><code><span class="str"> var a = 0;</span></code></li>
  293. <li class="L2"><code><span class="str"> var b = 1;</span></code></li>
  294. <li class="L3"><code><span class="str"> var c = a + b;</span></code></li>
  295. <li class="L4"><code><span class="str"> ```</span></code></li>
  296. </ol></pre>
  297. </div>
  298. <div class="remark-icons">
  299. </div>
  300. </div>
  301. </body>
  302. </html>