掌握 Markdown,例子

来源:互联网 发布:炒股入门知识软件 编辑:程序博客网 时间:2024/06/05 03:37

原文: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. One2. Two3. ThreeSometimes 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 documentsSometimes 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 headingYou 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 itemAnd, of course emoji! :sparkles: :camel: :boom:

GitHub的 markdown 支持许多额外的,可帮助您参考,并链接到人. 如果你想直接评论某人, 你可以用@符号的名称前缀: Hey @kneath — love your sweater!

但我不得不承认,任务列表是我最喜欢的:

  • [x] 这是一个完整的项目
  • [ ]这是一个不完整的项目

和, 当然表情符号!:sparkles: :camel: :boom:

0 0
原创粉丝点击