@lumincinta
2017-01-31T14:08:37.000000Z
字数 3839
阅读 382
Markdown
GitHub
Formatting like tables, syntax highlighting, and automatic linking allows you to arrange complex information clearly in your pull requests, issues, and comments.
You can build tables to organize information in comments, issues, pull requests, and wikis.
Share samples of code with fenced code blocks and enabling syntax highlighting.
References to URLs, issues, pull requests, and commits are automatically shortened and converted into links.
You can build tables to organize information in comments, issues, pull requests, and wikis.
You can create tables with pipes |
and hyphens -
. Hyphens are used to create each column's header, while pipes separate each column.
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
The pipes on either end of the table are optional.
Cells can vary in width and do not need to be perfectly aligned within columns. There must be at least three hyphens in each column of the header row.
| Command | Description |
| --- | --- |
| git status | List all new or modified files |
| git diff | Show file differences that haven't been staged |
You can use formatting such as links, inline code blocks, and text styling within your table:
| Command | Description |
| --- | --- |
| `git status` | List all *new or modified* files |
| `git diff` | Show file differences that **haven't been** staged |
You can align text to the left, right, or center of a column by including colons :
to the left, right, or on both sides of the hyphens within the header row.
| Left-aligned | Center-aligned | Right-aligned |
| :--- | :---: | ---: |
| git status | git status | git status |
| git diff | git diff | git diff |
To include a pipe |
as content within your cell, use a \
before the pipe:
| Name | Character |
| --- | --- |
| Backtick | ` |
| Pipe | \| |
Share samples of code with fenced code blocks and enabling syntax highlighting.
You can create fenced code blocks by placing triple backticks ````` before and after the code block. We recommend placing a blank line before and after code blocks to make the raw formatting easier to read.
```
function test() {
console.log("notice the blank line before this function?");
}
```
Tip: To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces.
You can add an optional language identifier to enable syntax highlighting in your fenced code block.
For example, to syntax highlight Ruby code:
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```
We use Linguist to perform language detection and syntax highlighting. You can find out which keywords are valid in the languages YAML file.
References to URLs, issues, pull requests, and commits are automatically shortened and converted into links.
GitHub automatically creates links from standard URLs.
Visit https://github.com
For more information on creating links, see "Basic writing and formatting syntax."
Within repositories, references to issues and pull requests are automatically converted to shortened links to the issue or pull request.
Reference type | Raw reference | Short link |
---|---|---|
Issue or pull request URL | https://github.com/jlord/sheetsee.js/issues/26 | #26 |
# and issue or pull request number |
26 | #26 |
GH- and issue or pull request number |
GH-26 | GH-26 |
Username/Repository# and issue or pull request number |
jlord/sheetsee.js#26 | jlord/sheetsee.js#26 |
References to a commit's SHA hash are automatically converted into shortened links to the commit on GitHub.
Reference type | Raw reference | Short link |
---|---|---|
Commit URL | https://github.com/jlord/sheetsee.js/commit/a5c3785ed8d6a35868bc169f07e40e889087fd2e | a5c3785 |
SHA | a5c3785ed8d6a35868bc169f07e40e889087fd2e | a5c3785 |
User@SHA | jlord@a5c3785ed8d6a35868bc169f07e40e889087fd2e | jlord@a5c3785 |
Username/Repository@SHA | User/Repository@SHA: jlord/sheetsee.js@a5c3785ed8d6a35868bc169f07e40e889087fd2e | jlord/sheetsee.js@a5c3785 |