翻译自 https://guides.github.com/features/mastering-markdown/

转载请注明链接

掌握Markdown

Markdown是Github平台上一种轻量且易用,用于设计写作的样式的语法。

我们会学习什么

  • Markdown格式如何简化风格化的协作编辑
  • Markdown和传统格式有何不同
  • 如何使用Markdown格式化文本
  • 如何使用Github的Markdown自动渲染
  • 如何应用Github独有的Markdown扩展

什么是Markdown?

Markdown是一中在web上设置文本样式的方法。你可以控制文档的显示;使用加粗或者斜体格式化单词,添加图片、创建列表只是我们使用Markdown时可以做的少数几件事情。最主要的是,Markdown只是包含一些非字母字符的普通文本,就像 #*

你可以在GItHub上的大多数地方使用Markdown:

  • Gists (GitHub的一个服务,类似于一个在线的记事本或便利贴,可以用来记录一些代码的小片段或者其他类似的内容)
  • 在问题中评论和合并请求(Pull Requests,应该是执行git pull命令的意思,获取并合并其他的库)
  • 文件使用.md.markdown作为扩展名

更多内容,请参阅github帮助中的“Writing on GitHub”

例子

文本——Text
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!

列表——Lists
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
效果如下:

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
图片——images
If you want to embed images, this is how you do it:

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

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

标题和注释——Headers & Quotes
# 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
效果如下:

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
代码——code
There are many different ways to style code with GitHub's markdown. If you have inline code blocks, wrap them in backticks: `var example = true`.  If you've got a longer block of code, you can indent with four spaces:

    if (isAwesome){
return true
} GitHub also supports something called code fencing, which allows for multiple lines without indentation: ```
if (isAwesome){
return true
}
``` And if you'd like to use syntax highlighting, include the language: ```javascript
if (isAwesome){
return true
}
```
效果如下

There are many different ways to style code with GitHub's markdown. If you have inline code blocks, wrap them in backticks: var example = true. If you've got a longer block of code, you can indent with four spaces:

if (isAwesome){
return true
}

GitHub also supports something called code fencing, which allows for multiple lines without indentation:

if (isAwesome){
return true
}

And if you'd like to use syntax highlighting, include the language:

if (isAwesome){
return true
}
其他——Extras
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 When you include a task list in the first comment of an Issue, you will see a helpful progress bar in your list of issues. It works in Pull Requests, too! And, of course emoji! :sparkles: :camel: :boom:
效果如下

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

When you include a task list in the first comment of an Issue, you will see a helpful progress bar in your list of issues. It works in Pull Requests, too!

And, of course emoji! ✨

掌握Markdown的更多相关文章

  1. NiceMark——我的Markdown编辑器

    NiceMark--我的Markdown编辑器 闲来无事,写了一个Markdown编辑器.基于electron,完全采用Web前段技术(Html,css,JavaScript)实现.代码已托管在Git ...

  2. Markdown 图片助手-MarkdownPicPicker

    title: Markdown 图片助手 v0.1 toc: true comments: true date: 2016-06-04 16:40:06 tags: [Python, Markdown ...

  3. 前端学Markdown

    前面的话   我个人理解,Markdown就是一个富文本编辑器语言,类似于sass对于css的功能,Markdown也可以叫做HTML预处理器,只不过它是一门轻量级的标记语言,可以更简单的实现HTML ...

  4. 好用的Markdown编辑器一览 readme.md 编辑查看

    https://github.com/pandao/editor.md https://pandao.github.io/editor.md/examples/index.html Editor.md ...

  5. mac好用的markdown编辑器

    在刚开始接触markdown的时候,就被吸引了.此后一直在找贴心的好用的markdown编辑器.印象笔记和马克飞象配合着用也是挺好的,唯一的缺点就是比较封闭,发个笔记的链接给同学,还得注册才能看,导致 ...

  6. Markdown学习笔记

    分为两步: 1.阅读Markdown中文官网的文档 2.下载MarkdownPad2将中文官网中文档的例子敲一遍,其中Markdownpad2为官网中推荐的编辑器 备注: 如果只看中文官网文档,不边看 ...

  7. Linux 中优秀的文本化编辑思想大碰撞(Markdown、LaTeX、MathJax)

    这样一个标题可能不太准确,因为确实无法准确地解释什么叫"文本化编辑思想".其实我这篇随笔主要是想探讨 Markdown.LaTeX.MathJax,有兴趣的朋友可以继续往下看,同时 ...

  8. Markdown是怎样接管我的各种的写作工作的

    对于一个程序猿来说,没有什么比单纯的写代码更能让人兴奋了.如果能让你像写代码一样写文档,不用再面对那些繁琐的样式,你会怎么看?它就是Markdown!即使博客园已经有不少介绍的文章了,但是我依然还是不 ...

  9. markdown常用语法总结

    转自markdown示例[模板] 1.1.段落标题 根据原文中的文档标题可以对应设置标题. # 一级标题## 二级标题### 三级标题 效果 => 一级标题 二级标题 三级标题 1.2.斜体.加 ...

  10. 基于 Cmd MarkDown 的 markdown 语法学习

    首先我要打一个属于干货的广告:CmdMarkDown 是非常好用的markdown编辑器软件,支持全平台,由作业部落出品,分为客户端与WEB端两种使用场景. 本篇博客学习的markdown语法都是基于 ...

随机推荐

  1. Java第一天——环境变量的配置与破解myeclipse2013

    一.jdk环境变量的配置 1.下载JDK并安装(官网JavaSE,64位(具体看电脑是多少位的))官网http://www.oracle.com/technetwork/java/javase/dow ...

  2. mysql group by分组查询错误修改

    select @@global.sql_mode;set @@sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR ...

  3. Sametime SDK

    1,Sametime Server A.Sametime includes many server applications, which collectively provide the capab ...

  4. BZOJ5302 HAOI2018奇怪的背包(动态规划)

    由裴蜀定理,子集S有解当且仅当gcd(S,P)|w. 一个显然的dp是设f[i][j]为前i个数gcd为j的选取方案.注意到这里的gcd一定是P的约数,所以状态数是n√P的.然后可以通过这个得到gcd ...

  5. C++ STL 常用排序算法

    C++ STL 常用排序算法 merge() 以下是排序和通用算法:提供元素排序策略 merge: 合并两个有序序列,存放到另一个序列. 例如: vecIntA,vecIntB,vecIntC是用ve ...

  6. 【HDU5469】Antonidas(点分治,字符串哈希)

    [HDU5469]Antonidas(点分治,字符串哈希) 题面 HDU Vjudge 题解 啊哈?什么垃圾一眼点分治+Hash判断,哈哈哈哈哈,让我来码码码. 诶,怎么WA了.改改改改改. 诶,怎么 ...

  7. 【BZOJ4197】【Noi2015】寿司晚宴

    Description 为了庆祝 NOI 的成功开幕,主办方为大家准备了一场寿司晚宴.小 G 和小 W 作为参加 NOI 的选手,也被邀请参加了寿司晚宴. 在晚宴上,主办方为大家提供了 n−1 种不同 ...

  8. 洛谷 P1357 花园 解题报告

    P1357 花园 题目描述 小\(L\)有一座环形花园,沿花园的顺时针方向,他把各个花圃编号为\(1~N(2<=N<=10^{15})\).他的环形花园每天都会换一个新花样,但他的花园都不 ...

  9. Linux内核分析实验六

    Linux内核分析实验六 进程控制块PCB——task_struct(进程描述符) 为了管理进程,内核必须对每个进程进行清晰的描述,进程描述符提供了内核所需了解的进程信息. struct task_s ...

  10. 解题:USACO12FEB Nearby Cows

    题面 比较简单的树形dp(递推?) 设$dp[i][j]$表示距离$i$距离为$j$的点的数目,先预处理$g[i][j]$表示点$i$的子树中距离这个点距离为$j$的点的数目(猫老师讲过,用一个栈维护 ...