GitHub中博客markdown语法

Markdown是一种轻量级且易于使用的语法,用于在GitHub平台上设置所有形式的书写样式。

What you will learn:

  • How the Markdown format makes styled collaborative editing easy
  • How Markdown differs from traditional formatting approaches
  • How to use Markdown to format text
  • How to leverage GitHub’s automatic Markdown rendering
  • How to apply GitHub’s unique Markdown extensions

What is Markdown?

什么是markdown?

百度百科: Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式。
Markdown具有一系列衍生版本,用于扩展Markdown的功能(如表格、脚注、内嵌HTML等等),这些功能原初的Markdown尚不具备,它们能让Markdown转换成更多的格式,例如LaTeX,Docbook。Markdown增强版中比较有名的有Markdown Extra、MultiMarkdown、 Maruku等。这些衍生版本要么基于工具,如Pandoc;要么基于网站,如GitHub和Wikipedia,在语法上基本兼容,但在一些语法和渲染效果上有改动。

GitHub: Markdown是一种在网络上设置文字样式的方法。您可以控制文档的显示;将单词格式化为粗体或斜体,添加图像和创建列表只是我们可以使用Markdown执行的一些操作。大多数情况下,Markdown只是常规文本,其中包含一些非字母字符,如#或*。

你可以在GitHub周围的大多数地方使用Markdown:

  • Gists
  • Comments in Issues and Pull Requests
  • Files with the .md or .markdown extension

想要了解更多信息, 点击 “Writing on GitHub” 。

语法指南

以下是Markdown语法的概述,您可以在GitHub.com或您自己的文本文件中的任何位置使用它。

分级标题

# This is an 

tag ## This is an

tag ###### This is an

tag

强调

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

_You **can** combine them_

无序列表

* Item 1
* Item 2
  * Item 2a
  * Item 2b

有序列表

1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   1. Item 3b

插入图片

GitHub图片插入实例

引用

As Kanye West said:

> We're living the future so
> the present is our past.

内联代码

I think you should use an
`` element here instead.

GitHub Flavored Markdown

GitHub.com使用自己版本的Markdown语法,该语法提供了一组额外的有用功能,其中许多功能可以更轻松地使用GitHub.com上的内容。

请注意,GitHub Flavored Markdown的某些功能仅在“问题和请求”的说明和注释中提供。这些包括@mentions以及对SHA-1哈希,问题和请求的引用。任务列表也可以在Gist注释和Gist Markdown文件中找到。

语法 高亮

以下是如何使用GitHub Flavored Markdown进行语法高亮显示的示例:

function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}

你也可以简单的缩进你的代码四格:

 function fancyAlert(arg) {
      if(arg) {
        $.facebox({div:'#foo'})
      }
    }

这是一个Python code 没有语法强调:

def foo():
    if not bar:
        return True

Task Lists

- [x] @mentions, #refs, [links](), **formatting**, and tags supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item

如果您在问题的第一条评论中包含任务列表,您将在问题列表中获得一个方便的进度指示器。它也适用于Pull Requests!

Tables

您可以通过组合单词列表​​并用连字符-(第一行)分隔,然后用管道分隔每个列来创建表格|

First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column

将会变成:

First Header Second Header
Content from cell 1 Content from cell 2
Content in the first column Content in the second column

Issue references within a repository

Any number that refers to an Issue or Pull Request will be automatically converted into a link.
(任何引用Issue或Pull Request的数字都将自动转换为链接。)

#1
mojombo#1
mojombo/github-flavored-markdown#1

Username @mentions

键入一个@符号,后跟一个用户名,将通知该人来查看评论。这被称为“@mention”,因为你提到的是个人。您还可以在组织内@mention团队。

自动连接url

Any URL (like http://www.github.com/) will be automatically converted into a clickable link.

删除线

Any word wrapped with two tildes (like this) will appear crossed out.

表情

GitHub supports emoji!

To see a list of every image we support, check out the Emoji Cheat Sheet.

总体来说,和CSDN中markdown语法没有什么大的区别,但也有一些小的改变,毕竟是为了适应GitHub的页面!

你可能感兴趣的:(GitHub)