[译] GitHub 风格的 Markdown 语法(2)

我们使用 Linguist 来进行语言识别和语法着色。你可以在 语言 YAML 文件 中查证哪些语言标识符是有效的。

Tables 表格

You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe |:

把一系列文本精心组织起来,我们甚至可以得到一个表格。我们需要把表头的那一行用一串横杠(-)隔出来,然后把每一列用竖杠(|)隔开:

First Header | Second Header ------------- | ------------- Content Cell | Content Cell Content Cell | Content Cell

For aesthetic purposes, you can also add extra pipes on the ends:

出于美观的考虑,你也可以在表格的两端都加上竖杠:

| First Header | Second Header | | ------------- | ------------- | | Content Cell | Content Cell | | Content Cell | Content Cell |

Note that the dashes at the top don't need to match the length of the header text exactly:

请注意,用于分隔列的竖杠并不需要跟表头严格对齐:

| Name | Description | | ------------- | ----------- | | Help | Display the help window.| | Close | Closes a window |

You can also include inline Markdown such as links, bold, italics, or strikethrough:

同时,你也可以在单元格内使用那些行内 Markdown 语法,比如加链接、加粗、加斜体或加删除线等等:

| Name | Description | | ------------- | ----------- | | Help | ~~Display the~~ help window.| | Close | _Closes_ a window |

Finally, by including colons : within the header row, you can define text to be left-aligned, right-aligned, or center-aligned:

最后别忘了,给表头下的各段横线加上冒号(:),还可以指定各列文本的对齐方式:

| Left-Aligned | Center Aligned | Right Aligned | | :------------ |:---------------:| -----:| | col 3 is | some wordy text | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 |

A colon on the left-most side indicates a left-aligned column; a colon on the right-most side indicates a right-aligned column; a colon on both sides indicates a center-aligned column.

在横线最左侧加冒号表示该列一律左对齐;在横线最右侧加冒号表示该列一律右对齐;在横线两端加冒号表示该列一律居中对齐。

HTML

You can use a subset of HTML within your READMEs, issues, and pull requests.

在 README、issue 和 PR 中,你还可以使用有限的一些 HTML 语法。

A full list of our supported tags and attributes can be found in the github/markup repository.

关于可用的标签和属性有哪些,你可以在 github/markup 这个项目中找到一份完整的清单。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13223.html