掌握 Markdown,例子

原文:https://guides.github.com/features/mastering-markdown/

Markdown 是一個輕量級的,易於使用的語法樣式,對於在GitHub的平臺上各種形式的寫作。
你會學到什麼

  • 如何Markdown格式使得風格的協作編輯容易
  • 如何Markdown不同於傳統格式化的方法
  • 如何應用Markdown格式化文本
  • 如何利用GitHub的自動 Markdown 渲染
  • 如何申請GitHub的獨特Markdown擴展

什麼是Markdown?
markdown是一種風格的文字在網絡上。您可以控制文檔的顯示;格式化詞組用粗體或斜體,添加圖像,並創建列表只是少數的事情,我們可以markdown做。大多數情況下,markdown只是常規文本帶有一些非字母字符投入了,如#或*。

您可以使用markdown大多數關於GitHub的地方:

  • Gists
  • 在問題評論和提交請求
  • 文件用 .md 或 .markdown 擴展名

例子

1.文本

It's very easy to make some words **bold** and other words *italic* with Markdown. You can even [link to Google!](http://google.com)

It’s very easy to make some words bold and other words italic with Markdown. You can even link to Google!

這很容易使一些詞加粗和 其他的詞用斜體用markdown。你甚至可以鏈接到百度!

2.列表

Sometimes you want numbered lists:

1. One
2. Two
3. Three

Sometimes you want bullet points:

* Start a line with a star
* Profit!

Alternatively,

- Dashes work just as well
- And if you have sub points, put two spaces before the dash or star:
  - Like this
  - And this

有時你想要編號列表:

  1. One
  2. Two
  3. Three

有時你想要小點:

  • Start a line with a star
  • Profit!

另外,

  • 破折號工作也一樣
  • 並且如果你有子節點, 放兩個空格在破折號或星號之前:
    • Like this
    • And this

3.圖片

If you want to embed images, this is how you do it:

![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)

如果你想插入圖片,這是你怎麼做:

Image of Yaktocat

4.頭和引用

# Structured documents

Sometimes it's useful to have different levels of headings to structure your documents. Start lines with a `#` to create headings. Multiple `##` in a row denote smaller heading sizes.

### This is a third-tier heading

You can use  one `#` all the way up to `######` six for different heading sizes.

If you'd like to quote someone, use the > character before the line:

> Coffee. The finest organic suspension ever devised... I beat the Borg with it.
> - Captain Janeway

結構化文檔

有時它是有用的有不同級別的標題來構建你的文檔。開始以#創建標題。連續多##在一行表示更小的標題大小。

這是一個三級標題

您可以使用一個一直達到######爲了不同的標題大小。

如果您想引用某人,在行前使用>字符:

Coffee. The finest organic suspension ever devised… I beat the Borg with it.
- Captain Janeway

5.代碼

有許多不同的方式來顯示代碼用GitHub的markdown。如果您有內嵌代碼塊,包裝在反引號:var example = true。如果你有一個更長的代碼塊,你可以用四個空格縮進:

if (isAwesome){
  return true
}

GitHub上還支持一種叫代碼擊劍,它允許不帶縮進多行:

if (isAwesome){
  return true
}

如果你想使用語法高亮,包括語言:

if (isAwesome){
  return true
}

6.額外

GitHub supports many extras in Markdown that help you reference and link to people. If you ever want to direct a comment at someone, you can prefix their name with an @ symbol: Hey @kneath — love your sweater!

But I have to admit, tasks lists are my favorite:

- [x] This is a complete item
- [ ] This is an incomplete item

And, of course emoji! :sparkles: :camel: :boom:

GitHub的 markdown 支持許多額外的,可幫助您參考,並鏈接到人. 如果你想直接評論某人, 你可以用@符號的名稱前綴: Hey @kneath — love your sweater!

但我不得不承認,任務列表是我最喜歡的:

  • [x] 這是一個完整的項目
  • [ ]這是一個不完整的項目

和, 當然表情符號!:sparkles: :camel: :boom:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章