mdman

index.html 34KB

    <!DOCTYPE html><html> <head> <script type="text/javascript"> var host = "mdman.zning.me"; if ((host == window.location.host) && (window.location.protocol != "https:")) window.location.protocol = "https"; </script> <meta charset="utf-8"> <title>Markdown 语法参考</title> <style> @font-face { font-family: octicons-anchor; src: url(data:font/woff;charset=utf-8;base64,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) format('woff'); } body { background-color: white; } .markdown-body { min-width: 200px; max-width: 760px; margin: 0 auto; padding: 30px; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; color: #333; overflow: hidden; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 16px; line-height: 1.6; word-wrap: break-word; } .markdown-body a { background: transparent; } .markdown-body a:active, .markdown-body a:hover { outline: 0; } .markdown-body strong { font-weight: bold; } .markdown-body h1 { font-size: 2em; margin: 0.67em 0; } .markdown-body img { border: 0; } .markdown-body hr { -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } .markdown-body pre { overflow: auto; } .markdown-body code, .markdown-body kbd, .markdown-body pre { font-family: monospace, monospace; font-size: 1em; } .markdown-body input { color: inherit; font: inherit; margin: 0; } .markdown-body html input[disabled] { cursor: default; } .markdown-body input { line-height: normal; } .markdown-body input[type="checkbox"] { -moz-box-sizing: border-box; box-sizing: border-box; padding: 0; } .markdown-body table { border-collapse: collapse; border-spacing: 0; } .markdown-body td, .markdown-body th { padding: 0; } .markdown-body * { -moz-box-sizing: border-box; box-sizing: border-box; } .markdown-body input { font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; } .markdown-body a { color: #4183c4; text-decoration: none; } .markdown-body a:hover, .markdown-body a:focus, .markdown-body a:active { text-decoration: underline; } .markdown-body hr { height: 0; margin: 15px 0; overflow: hidden; background: transparent; border: 0; border-bottom: 1px solid #ddd; } .markdown-body hr:before { display: table; content: ""; } .markdown-body hr:after { display: table; clear: both; content: ""; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin-top: 15px; margin-bottom: 15px; line-height: 1.1; } .markdown-body h1 { font-size: 30px; } .markdown-body h2 { font-size: 21px; } .markdown-body h3 { font-size: 16px; } .markdown-body h4 { font-size: 14px; } .markdown-body h5 { font-size: 12px; } .markdown-body h6 { font-size: 11px; } .markdown-body blockquote { margin: 0; } .markdown-body ul, .markdown-body ol { padding: 0; margin-top: 0; margin-bottom: 0; } .markdown-body ol ol, .markdown-body ul ol { list-style-type: lower-roman; } .markdown-body ul ul ol, .markdown-body ul ol ol, .markdown-body ol ul ol, .markdown-body ol ol ol { list-style-type: lower-alpha; } .markdown-body dd { margin-left: 0; } .markdown-body code { font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; } .markdown-body pre { margin-top: 0; margin-bottom: 0; font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; } .markdown-body kbd { background-color: #e7e7e7; background-image: -webkit-linear-gradient(#fefefe, #e7e7e7); background-image: linear-gradient(#fefefe, #e7e7e7); background-repeat: repeat-x; border-radius: 2px; border: 1px solid #cfcfcf; color: #000; padding: 3px 5px; line-height: 10px; font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; display: inline-block; } .markdown-body>*:first-child { margin-top: 0 !important; } .markdown-body>*:last-child { margin-bottom: 0 !important; } .markdown-body .anchor { position: absolute; top: 0; bottom: 0; left: 0; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; } .markdown-body .anchor:focus { outline: none; } .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { position: relative; margin-top: 1em; margin-bottom: 16px; font-weight: bold; line-height: 1.4; } .markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { display: none; color: #000; vertical-align: middle; } .markdown-body h1:hover .anchor, .markdown-body h2:hover .anchor, .markdown-body h3:hover .anchor, .markdown-body h4:hover .anchor, .markdown-body h5:hover .anchor, .markdown-body h6:hover .anchor { height: 1em; padding-left: 8px; margin-left: -30px; line-height: 1; text-decoration: none; } .markdown-body h1:hover .anchor .octicon-link, .markdown-body h2:hover .anchor .octicon-link, .markdown-body h3:hover .anchor .octicon-link, .markdown-body h4:hover .anchor .octicon-link, .markdown-body h5:hover .anchor .octicon-link, .markdown-body h6:hover .anchor .octicon-link { display: inline-block; } .markdown-body h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid #eee; } .markdown-body h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid #eee; } .markdown-body h3 { font-size: 1.5em; line-height: 1.43; } .markdown-body h4 { font-size: 1.25em; } .markdown-body h5 { font-size: 1em; } .markdown-body h6 { font-size: 1em; color: #777; } .markdown-body p, .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre { margin-top: 0; margin-bottom: 16px; } .markdown-body hr { height: 4px; padding: 0; margin: 16px 0; background-color: #e7e7e7; border: 0 none; } .markdown-body ul, .markdown-body ol { padding-left: 2em; } .markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ol, .markdown-body ol ul { margin-top: 0; margin-bottom: 0; } .markdown-body li>p { margin-top: 16px; } .markdown-body dl { padding: 0; } .markdown-body dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: bold; } .markdown-body dl dd { padding: 0 16px; margin-bottom: 16px; } .markdown-body blockquote { padding: 0 15px; color: #777; border-left: 4px solid #ddd; } .markdown-body blockquote>:first-child { margin-top: 0; } .markdown-body blockquote>:last-child { margin-bottom: 0; } .markdown-body table { display: block; width: 100%; overflow: auto; word-break: normal; word-break: keep-all; } .markdown-body table th { font-weight: bold; } .markdown-body table th, .markdown-body table td { padding: 6px 13px; border: 1px solid #ddd; } .markdown-body table tr { background-color: #fff; border-top: 1px solid #ccc; } .markdown-body table tr:nth-child(2n) { background-color: #f8f8f8; } .markdown-body img { max-width: 100%; -moz-box-sizing: border-box; box-sizing: border-box; } .markdown-body code { padding: 0; padding-top: 0.2em; padding-bottom: 0.2em; margin: 0; font-size: 85%; background-color: rgba(0,0,0,0.04); border-radius: 3px; } .markdown-body code:before, .markdown-body code:after { letter-spacing: -0.2em; content: "\00a0"; } .markdown-body pre>code { padding: 0; margin: 0; font-size: 100%; word-break: normal; white-space: pre; background: transparent; border: 0; } .markdown-body .highlight { margin-bottom: 16px; } .markdown-body .highlight pre, .markdown-body pre { padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: #f7f7f7; border-radius: 3px; } .markdown-body .highlight pre { margin-bottom: 0; word-break: normal; } .markdown-body pre { word-wrap: normal; } .markdown-body pre code { display: inline; max-width: initial; padding: 0; margin: 0; overflow: initial; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } .markdown-body pre code:before, .markdown-body pre code:after { content: normal; } .markdown-body .highlight { background: #fff; } .markdown-body .highlight .mf, .markdown-body .highlight .mh, .markdown-body .highlight .mi, .markdown-body .highlight .mo, .markdown-body .highlight .il, .markdown-body .highlight .m { color: #945277; } .markdown-body .highlight .s, .markdown-body .highlight .sb, .markdown-body .highlight .sc, .markdown-body .highlight .sd, .markdown-body .highlight .s2, .markdown-body .highlight .se, .markdown-body .highlight .sh, .markdown-body .highlight .si, .markdown-body .highlight .sx, .markdown-body .highlight .s1 { color: #df5000; } .markdown-body .highlight .kc, .markdown-body .highlight .kd, .markdown-body .highlight .kn, .markdown-body .highlight .kp, .markdown-body .highlight .kr, .markdown-body .highlight .kt, .markdown-body .highlight .k, .markdown-body .highlight .o { font-weight: bold; } .markdown-body .highlight .kt { color: #458; } .markdown-body .highlight .c, .markdown-body .highlight .cm, .markdown-body .highlight .c1 { color: #998; font-style: italic; } .markdown-body .highlight .cp, .markdown-body .highlight .cs { color: #999; font-weight: bold; } .markdown-body .highlight .cs { font-style: italic; } .markdown-body .highlight .n { color: #333; } .markdown-body .highlight .na, .markdown-body .highlight .nv, .markdown-body .highlight .vc, .markdown-body .highlight .vg, .markdown-body .highlight .vi { color: #008080; } .markdown-body .highlight .nb { color: #0086B3; } .markdown-body .highlight .nc { color: #458; font-weight: bold; } .markdown-body .highlight .no { color: #094e99; } .markdown-body .highlight .ni { color: #800080; } .markdown-body .highlight .ne { color: #990000; font-weight: bold; } .markdown-body .highlight .nf { color: #945277; font-weight: bold; } .markdown-body .highlight .nn { color: #555; } .markdown-body .highlight .nt { color: #000080; } .markdown-body .highlight .err { color: #a61717; background-color: #e3d2d2; } .markdown-body .highlight .gd { color: #000; background-color: #fdd; } .markdown-body .highlight .gd .x { color: #000; background-color: #faa; } .markdown-body .highlight .ge { font-style: italic; } .markdown-body .highlight .gr { color: #aa0000; } .markdown-body .highlight .gh { color: #999; } .markdown-body .highlight .gi { color: #000; background-color: #dfd; } .markdown-body .highlight .gi .x { color: #000; background-color: #afa; } .markdown-body .highlight .go { color: #888; } .markdown-body .highlight .gp { color: #555; } .markdown-body .highlight .gs { font-weight: bold; } .markdown-body .highlight .gu { color: #800080; font-weight: bold; } .markdown-body .highlight .gt { color: #aa0000; } .markdown-body .highlight .ow { font-weight: bold; } .markdown-body .highlight .w { color: #bbb; } .markdown-body .highlight .sr { color: #017936; } .markdown-body .highlight .ss { color: #8b467f; } .markdown-body .highlight .bp { color: #999; } .markdown-body .highlight .gc { color: #999; background-color: #EAF2F5; } .markdown-body .octicon { font: normal normal 16px octicons-anchor; line-height: 1; display: inline-block; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .markdown-body .octicon-link:before { content: '\f05c'; } .markdown-body .task-list-item { list-style-type: none; } .markdown-body .task-list-item+.task-list-item { margin-top: 3px; } .markdown-body .task-list-item input { float: left; margin: 0.3em 0 0.25em -1.6em; vertical-align: middle; } /* github.com style (c) Vasily Polovnyov <vast@whiteants.net> */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; -webkit-text-size-adjust: none; } .hljs-comment, .diff .hljs-header { color: #998; font-style: italic; } .hljs-keyword, .css .rule .hljs-keyword, .hljs-winutils, .nginx .hljs-title, .hljs-subst, .hljs-request, .hljs-status { color: #333; font-weight: bold; } .hljs-number, .hljs-hexcolor, .ruby .hljs-constant { color: #008080; } .hljs-string, .hljs-tag .hljs-value, .hljs-doctag, .tex .hljs-formula { color: #d14; } .hljs-title, .hljs-id, .scss .hljs-preprocessor { color: #900; font-weight: bold; } .hljs-list .hljs-keyword, .hljs-subst { font-weight: normal; } .hljs-class .hljs-title, .hljs-type, .vhdl .hljs-literal, .tex .hljs-command { color: #458; font-weight: bold; } .hljs-tag, .hljs-tag .hljs-title, .hljs-rule .hljs-property, .django .hljs-tag .hljs-keyword { color: #000080; font-weight: normal; } .hljs-attribute, .hljs-variable, .lisp .hljs-body, .hljs-name { color: #008080; } .hljs-regexp { color: #009926; } .hljs-symbol, .ruby .hljs-symbol .hljs-string, .lisp .hljs-keyword, .clojure .hljs-keyword, .scheme .hljs-keyword, .tex .hljs-special, .hljs-prompt { color: #990073; } .hljs-built_in { color: #0086b3; } .hljs-preprocessor, .hljs-pragma, .hljs-pi, .hljs-doctype, .hljs-shebang, .hljs-cdata { color: #999; font-weight: bold; } .hljs-deletion { background: #fdd; } .hljs-addition { background: #dfd; } .diff .hljs-change { background: #0086b3; } .hljs-chunk { color: #aaa; } </style> <style> @media print{ .hljs{overflow: visible; word-wrap: break-word !important;} }</style></head><body><div class="markdown-body"> <h1 id="toc_0">Markdown语法参考</h1> <p>Markdown 是一种 Lightweight 标记语言,易读、易写、易改,主要为了方便在 Web 端快速书写文档,由转换器转换为 HTML 呈现在 Web 页面上,最初的 Markdown 转换程序,是一个 Perl 脚本。Markdown 可以使用简单的几个字符,如 <code>#</code>, <code>*</code>, 等,编写出格式丰富的整齐化一的文档来。</p> <p>现在,越来越多的 Web 程序支持 Markdown 的在线编辑和展示,如:</p> <ul> <li><a href="https://github.com/">GitHub</a></li> <li><a href="http://stackoverflow.com/">Stack Overflow</a></li> <li><a href="https://www.reddit.com/">Reddit</a></li> <li><a href="http://www.jianshu.com/">简书</a></li> <li><a href="https://www.zybuluo.com/">作业部落</a></li> </ul> <p>专用于 Downdown 写作或支持该格式编写的编辑器很多,Windows 平台有 Typora, MarkdownPad, MarkPad 等。OSX 平台可选的就太多了,有 Mou, Ulysses, iA Writer, Typed, MacDown, Typora 等一系列好用的工具软件。除此之外,还有一大批如 GNU Emacs, Vim, Sublime Tex, Atom 等猿类编辑器也支持这种格式。</p> <p>Markdown 文件一般用 <code>.md</code> 或 <code>.markdown</code> 作为扩展名。</p> <ul> <li> <a href="#toc_0">Markdown语法参考</a> </li> <li> <a href="#toc_1">1. 标准Markdown</a> <ul> <li> <ul> <li> <a href="#toc_2">1.1 加粗和强调</a> </li> <li> <a href="#toc_3">1.2 链接和Email</a> </li> <li> <a href="#toc_4">1.3 图片</a> </li> <li> <a href="#toc_5">1.4 标题</a> </li> <li> <a href="#toc_6">1.5 列表</a> </li> <li> <a href="#toc_7">1.6 引用</a> </li> </ul> </li> <li> <a href="#toc_9">1.7 代码</a> <ul> <li> <a href="#toc_10">1.7.1 行内代码</a> </li> <li> <a href="#toc_11">1.7.2 代码块</a> </li> </ul> </li> <li> <a href="#toc_12">1.8 换行</a> </li> <li> <a href="#toc_13">1.9 水平线</a> </li> <li> <a href="#toc_14">1.10 反斜杠</a> </li> </ul> </li> <li> <a href="#toc_15">2. 其他语法</a> <ul> <li> <a href="#toc_16">2.1 脚注</a> </li> <li> <a href="#toc_17">2.2 表格</a> </li> <li> <a href="#toc_18">2.3 锚点</a> </li> <li> <a href="#toc_19">2.4 删除线</a> </li> </ul> </li> <li> <a href="#toc_20">3. GitHub 支持的 Markdown 语法</a> <ul> <li> <a href="#toc_21">3.1 语法高亮</a> </li> <li> <a href="#toc_22">3.2 任务列表</a> </li> <li> <a href="#toc_23">3.3 SHA 引用</a> </li> <li> <a href="#toc_24">3.4 同一个仓库中的 Issue 引用</a> </li> <li> <a href="#toc_25">3.5 @某用户</a> </li> <li> <a href="#toc_26">3.6 自动链接</a> </li> <li> <a href="#toc_27">3.7 对 emoji 的支持</a> </li> </ul> </li> <li> <a href="#toc_28">4.其他支持项目</a> <ul> <li> <a href="#toc_29">4.1 复选框列表</a> </li> <li> <a href="#toc_30">4.2 Html 标签</a> </li> <li> <a href="#toc_31">4.3 待办事宜 Todo 列表</a> </li> </ul> </li> <li> <a href="#toc_32">参考文档</a> </li> <li> <a href="#toc_33">协议</a> </li> <li> <a href="#toc_34">本文档原文链接</a> </li> </ul> </li> </ul> <h1 id="toc_1">1. 标准Markdown</h1> <h3 id="toc_2">1.1 加粗和强调</h3> <pre><code>*emphasize* **strong** _emphasize_ __strong__ _强调是可以**嵌套**的_ </code></pre> <p><em>emphasize</em> <strong>emphasize</strong></p> <p><u>emphasize</u> <strong>strong</strong></p> <p><u>强调是可以<strong>嵌套</strong>的</u></p> <h3 id="toc_3">1.2 链接和Email</h3> <pre><code>链接到 [Github](https://github.com/ &quot;Github&quot;). </code></pre> <p>链接到 <a href="https://github.com/" title="Github">Github</a>.</p> <pre><code>定义链接的ID后 [example][id],可以在文档下方再定义链接的目标地址: </code></pre> <pre><code>[id]: http://example.com/ &quot;Title&quot; </code></pre> <p>定义链接的ID后 <a href="http://example.com/" title="Title">example</a>,可以在文档下方再定义链接的目标地址:</p> <p>电子邮件链接:</p> <pre><code>电子邮件链接实例 &lt;example@example.com&gt; </code></pre> <p>电子邮件链接实例 <a href="mailto:example@example.com">example@example.com</a></p> <h3 id="toc_4">1.3 图片</h3> <pre><code>![图片替换文本(禁止显示图片时会显示此文本)](/path/img.jpg &quot;图片标题(鼠标放到图片上时会显示此文本)&quot;) </code></pre> <p>图片也可以先插入到正文,之后再根据 id 定义图片的路径和显示文本:</p> <pre><code>![图片替换文本(禁止显示图片时会显示此文本)][id] </code></pre> <pre><code>[id]: /url/to/img.jpg &quot;图片标题(鼠标放到图片上时会显示此文本)&quot; </code></pre> <h3 id="toc_5">1.4 标题</h3> <p>Markdown 支持两种标题的语法,类 Setext 和类 Atx 形式。</p> <p>Atx 形式最多支持6级标题:</p> <pre><code># Header 1 # ## Header 2 ## ... ###### Header 6 </code></pre> <p>类 Setext 形式是用底线的形式,利用 = (一级标题)和 - (二级标题)</p> <pre><code>Header 1 ======== Header 2 -------- </code></pre> <p>这种方式不推荐,统一使用类 Atx 形式即可。</p> <h3 id="toc_6">1.5 列表</h3> <p>Markdown 支持有序列表和无序列表。</p> <p><code>&lt;ul&gt;</code> 无序列表使用星号<code>*</code>、加号<code>+</code>或是减号<code>-</code>-作为列表标记:</p> <pre><code>* Item 1 * Item 2 * Item 2a * Item 2b </code></pre> <ul> <li>Item 1</li> <li>Item 2 <ul> <li>Item 2a</li> <li>Item 2b</li> </ul></li> </ul> <p><code>&lt;ol&gt;</code> 有序列表则使用数字接着一个英文句点:</p> <p>有序列表和无序列表可以混合嵌套:</p> <pre><code>1. Item 1 2. Item 2 3. Item 3 * Item 3a * Item 3b </code></pre> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3 <ul> <li>Item 3a</li> <li>Item 3b</li> </ul></li> </ol> <p>需要说明的一点是,你在列表标记上使用的数字并不会影响输出的 HTML 结果,上面的列表所产生的 HTML 标记为:<br/> <code><br/> &lt;ol&gt;<br/> &lt;li&gt;Bird&lt;/li&gt;<br/> &lt;li&gt;McHale&lt;/li&gt;<br/> &lt;li&gt;Parish&lt;/li&gt;<br/> &lt;/ol&gt;<br/> </code><br/> 如果你的列表标记写成:<br/> <code><br/> 1. Bird<br/> 1. McHale<br/> 1. Parish<br/> </code><br/> 甚至是:<br/> <code><br/> 3. Bird<br/> 1. McHale<br/> 8. Parish<br/> </code><br/> 你都会得到完全相同的 HTML 输出。重点在于,你可以让 Markdown 文件的列表数字和输出的结果相同,或是你懒一点,你可以完全不用在意数字的正确性。</p> <p>如果你使用懒惰的写法,建议第一个项目最好还是从 1. 开始,因为 Markdown 未来可能会支持有序列表的 start 属性。</p> <p>当然,项目列表很可能会不小心产生,像是下面这样的写法<br/> <code><br/> 1986. What a great season.<br/> </code><br/> 换句话说,也就是在行首出现数字-句点-空白,要避免这样的状况,你可以在句点前面加上反斜杠。<br/> <code><br/> 1986\. What a great season.<br/> </code></p> <h3 id="toc_7">1.6 引用</h3> <pre><code>&gt; Email-style angle brackets &gt; are used for blockquotes. &gt; &gt; And, they can be nested. &gt; #### Headers in blockquotes &gt; &gt; * You can quote a list. &gt; * Etc. </code></pre> <blockquote> <p>Email-style angle brackets<br/> are used for blockquotes.</p> <blockquote> <p>And, they can be nested.</p> </blockquote> <h4 id="toc_8">Headers in blockquotes</h4> <ul> <li>You can quote a list.</li> <li>Etc.</li> </ul> </blockquote> <h3 id="toc_9">1.7 代码</h3> <h4 id="toc_10">1.7.1 行内代码</h4> <pre><code>行内代码 `&lt;code&gt;`,也可以放在反引号之间:`` &lt;code&gt; ``。 </code></pre> <p>行内代码 <code>&lt;code&gt;</code>,也可以放在两对反引号之间:<code>&lt;code&gt;</code>。</p> <h4 id="toc_11">1.7.2 代码块</h4> <p>代码块每行前添加 缩进 4个空格 或 1个制表符:</p> <pre><code>#!/usr/bin/perl use strict; use warnings; # first, create your message use Email::MIME; my $message = Email::MIME-&gt;create( header_str =&gt; [ From =&gt; &#39;you@example.com&#39;, To =&gt; &#39;friend@example.com&#39;, Subject =&gt; &#39;Happy birthday!&#39;, ], attributes =&gt; { encoding =&gt; &#39;quoted-printable&#39;, charset =&gt; &#39;ISO-8859-1&#39;, }, body_str =&gt; &quot;Happy birthday to you!\n&quot;, ); # send the message use Email::Sender::Simple qw(sendmail); sendmail($message); </code></pre> <h3 id="toc_12">1.8 换行</h3> <p>插入一个空白行即可</p> <h3 id="toc_13">1.9 水平线</h3> <p>3个以上短线或*号:</p> <pre><code>--- * * * - - - - </code></pre> <h3 id="toc_14">1.10 反斜杠</h3> <p>Markdown 可以利用反斜杠来插入一些在语法中有其它意义的符号,例如:如果你想要用星号加在文字旁边的方式来做出强调效果(但不用 <code>&lt;em&gt;</code> 标签),你可以在星号的前面加上反斜杠:<br/> <code><br/> \*literal asterisks\*<br/> </code></p> <p>Markdown 支持以下这些符号前面加上反斜杠来帮助插入普通的符号:<br/> <code><br/> \ 反斜线<br/> ` 反引号<br/> * 星号<br/> _ 底线<br/> {} 花括号<br/> [] 方括号<br/> () 括弧<br/> # 井字号<br/> + 加号<br/> - 减号<br/> . 英文句点<br/> ! 惊叹号<br/> </code></p> <h2 id="toc_15">2. 其他语法</h2> <h3 id="toc_16">2.1 脚注</h3> <pre><code>这些文字带有脚注[^1] </code></pre> <pre><code>[^1]: 我是脚注。 </code></pre> <h3 id="toc_17">2.2 表格</h3> <p>简单表格:</p> <pre><code>First Header | Second Header | Third Header ------------ | ------------- | ------------ Content Cell | Content Cell | Content Cell Content Cell | Content Cell | Content Cell </code></pre> <table> <thead> <tr> <th>First Header</th> <th>Second Header</th> <th>Third Header</th> </tr> </thead> <tbody> <tr> <td>Content Cell</td> <td>Content Cell</td> <td>Content Cell</td> </tr> <tr> <td>Content Cell</td> <td>Content Cell</td> <td>Content Cell</td> </tr> </tbody> </table> <p>也可以在行首和行尾加上 | ,效果一样:</p> <pre><code>| First Header | Second Header | Third Header | | ------------ | ------------- | ------------ | | Content Cell | Content Cell | Content Cell | | Content Cell | Content Cell | Content Cell | </code></pre> <table> <thead> <tr> <th>First Header</th> <th>Second Header</th> <th>Third Header</th> </tr> </thead> <tbody> <tr> <td>Content Cell</td> <td>Content Cell</td> <td>Content Cell</td> </tr> <tr> <td>Content Cell</td> <td>Content Cell</td> <td>Content Cell</td> </tr> </tbody> </table> <p>使用英文冒号可以给列设定对齐方式:</p> <pre><code>First Header | Second Header | Third Header :----------- | :-----------: | -----------: Left | Center | Right Left | Center | Right </code></pre> <table> <thead> <tr> <th style="text-align: left">First Header</th> <th style="text-align: center">Second Header</th> <th style="text-align: right">Third Header</th> </tr> </thead> <tbody> <tr> <td style="text-align: left">Left</td> <td style="text-align: center">Center</td> <td style="text-align: right">Right</td> </tr> <tr> <td style="text-align: left">Left</td> <td style="text-align: center">Center</td> <td style="text-align: right">Right</td> </tr> </tbody> </table> <h3 id="toc_18">2.3 锚点</h3> <p>Markdown 中也可以给使用锚链接,下面这是一个普通的 H2 标题:</p> <pre><code>## H2 标题实例 </code></pre> <p>加个 id 属性就可以给标题加上锚点:</p> <pre><code>## [带锚点的 H2 实例](id:anchor1) </code></pre> <p>链接到上面的锚点,我们只需要如下的语法即可:</p> <pre><code>预览时点击 [锚链接](#anchor1) </code></pre> <h3 id="toc_19">2.4 删除线</h3> <pre><code>~~Strikethrough~~ </code></pre> <p><del>Strikethrough 实例</del></p> <h2 id="toc_20">3. GitHub 支持的 Markdown 语法</h2> <h3 id="toc_21">3.1 语法高亮</h3> <pre><code>```javascript function fancyAlert(arg) { if(arg) { $.facebox({div:&#39;#foo&#39;}) } } ``` </code></pre> <pre><code class="language-javascript">function fancyAlert(arg) { if(arg) { $.facebox({div:&#39;#foo&#39;}) } } </code></pre> <p>GitHub 支持的编程语主高亮列表,请查看 <a href="https://github.com/github/linguist/blob/master/lib/linguist/languages.yml">linguist</a>。</p> <h3 id="toc_22">3.2 任务列表</h3> <pre><code>- [x] @mentions, #refs, [links](), **formatting**, and &lt;del&gt;tags&lt;/del&gt; supported - [x] list syntax required (any unordered or ordered list supported) - [x] this is a complete item - [ ] this is an incomplete item </code></pre> <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> @mentions, #refs, <a href="">links</a>, <strong>formatting</strong>, and <del>tags</del> supported </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> list syntax required (any unordered or ordered list supported) </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> this is a complete item </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> this is an incomplete item </li> </ul> <h3 id="toc_23">3.3 SHA 引用</h3> <p>GitHub 上每个提交都有一个 SHA-1 hash,用它在文档中添加一个指向 GitHut 提交的链接:</p> <pre><code>16c999e8c71134401a78d4d46435517b2271d6ac mojombo@16c999e8c71134401a78d4d46435517b2271d6ac mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac </code></pre> <h3 id="toc_24">3.4 同一个仓库中的 Issue 引用</h3> <p>类似 SHA 引用,也可以添加指定编码的仓库内 Issue 或 Pull Request 链接:</p> <pre><code>#1 mojombo#1 mojombo/github-flavored-markdown#1 </code></pre> <h3 id="toc_25">3.5 @某用户</h3> <p>类似微博,也可以在 GitHub Markdown 文档中添加 <code>@WisdomFusion</code> 的提醒。</p> <h3 id="toc_26">3.6 自动链接</h3> <p>任何光秃秃的链接都会被自动转为链接的,如</p> <p><a href="https://github.com/">https://github.com/</a></p> <h3 id="toc_27">3.7 对 emoji 的支持</h3> <p>这个比较炫酷,文档中还支持 emoji!<br/> <code><br/> :smile: :exclamation: :thumbsup:<br/> </code><br/> :smile: :exclamation: :thumbsup:</p> <p>emoji列表:<a href="http://www.emoji-cheat-sheet.com/">http://www.emoji-cheat-sheet.com/</a></p> <p>详细查看<a href="./emoji.html">emoji</a>.</p> <h2 id="toc_28">4.其他支持项目</h2> <h3 id="toc_29">4.1 复选框列表</h3> <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> C </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> C++ </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> Java </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> Qt </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> Android </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> C# </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> .NET </li> </ul> <h3 id="toc_30">4.2 Html 标签</h3> <p>本站支持在 Markdown 语法中嵌套 Html 标签,譬如,你可以用 Html 写一个纵跨两行的表格:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;th rowspan=&quot;2&quot;&gt;值班人员&lt;/th&gt; &lt;th&gt;星期一&lt;/th&gt; &lt;th&gt;星期二&lt;/th&gt; &lt;th&gt;星期三&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;李强&lt;/td&gt; &lt;td&gt;张明&lt;/td&gt; &lt;td&gt;王平&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <table> <tr> <th rowspan="2">值班人员</th> <th>星期一</th> <th>星期二</th> <th>星期三</th> </tr> <tr> <td>李强</td> <td>张明</td> <td>王平</td> </tr> </table> <h3 id="toc_31">4.3 待办事宜 Todo 列表</h3> <p>使用带有 [ ] 或 [x] (未完成或已完成)项的列表语法撰写一个待办事宜列表,并且支持子列表嵌套以及混用Markdown语法,例如:</p> <pre><code>- [ ] **Cmd Markdown 开发** - [ ] 改进 Cmd 渲染算法,使用局部渲染技术提高渲染效率 - [ ] 支持以 PDF 格式导出文稿 - [x] 新增Todo列表功能 - [x] 改进 LaTex 功能 - [x] 修复 LaTex 公式渲染问题 - [x] 新增 LaTex 公式编号功能 - [ ] **七月旅行准备** - [ ] 准备邮轮上需要携带的物品 - [ ] 浏览日本免税店的物品 - [x] 购买蓝宝石公主号七月一日的船票 </code></pre> <p>对应显示如下待办事宜 Todo 列表:</p> <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <strong>Cmd Markdown 开发</strong> <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> 改进 Cmd 渲染算法,使用局部渲染技术提高渲染效率 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> 支持以 PDF 格式导出文稿 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> 新增Todo列表功能 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> 改进 LaTex 功能 <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> 修复 LaTex 公式渲染问题 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> 新增 LaTex 公式编号功能 </li> </ul> </li> </ul> </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <strong>七月旅行准备</strong> <ul> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> 准备邮轮上需要携带的物品 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" /> 浏览日本免税店的物品 </li> <li class="task-list-item"><input disabled="disabled" type="checkbox" checked /> 购买蓝宝石公主号七月一日的船票 </li> </ul> </li> </ul> <h2 id="toc_32">参考文档</h2> <ul> <li><a href="https://guides.github.com/features/mastering-markdown/">https://guides.github.com/features/mastering-markdown/</a></li> <li><a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/">https://help.github.com/articles/basic-writing-and-formatting-syntax/</a></li> <li><a href="http://www.markdown.cn/">http://www.markdown.cn/</a></li> </ul> <h2 id="toc_33">协议</h2> <p>文档基于MIT协议,由<a href="https://github.com/WisdomFusion/markdown-reference">WisdomFusion</a>在Github上分享。由ZNing生成Website</p> <h2 id="toc_34">本文档原文链接</h2> <p><a href="https://git.zning.net.cn/zning/mdman/src/gh-pages/Markdown%E8%AF%AD%E6%B3%95%E5%8F%82%E8%80%83.md">单击查看</a></p> </div></body> </html>