@@ -6,6 +6,7 @@ description: markdown syntax
6
6
---
7
7
8
8
本文翻译自:
9
+
9
10
* < https://help.github.com/articles/markdown-basics/ >
10
11
* < https://help.github.com/articles/github-flavored-markdown/ >
11
12
* < https://help.github.com/articles/writing-on-github/ >
@@ -161,7 +162,7 @@ SM会将每行开头包含四个空格的文本转换成代码块, 而GFM也支
161
162
162
163
```
163
164
function test() {
164
- console.log("notice the blank line before this function?");
165
+ console.log("notice the blank line before this function?");
165
166
}
166
167
```
167
168
@@ -232,4 +233,172 @@ SM会将每行开头包含四个空格的文本转换成代码块, 而GFM也支
232
233
233
234
[ markup ] : https://github.com/github/markup
234
235
236
+ ## 3. 精通Markdown
237
+
238
+ Markdown是一种轻量且容易使用的语法, 用于GitHub平台所书写的所有类型.
239
+
240
+ ### 你将会学习到
241
+
242
+ * Markdown格式是如何使协同编辑变得容易的.
243
+ * Markdown是如何和传统的格式化方式不同的.
244
+ * 如何使用Markdown格式化文本.
245
+ * 如何利用GitHub的自动Markdown渲染.
246
+ * 如何应用GitHub独有的Markdown扩展
247
+
248
+ ### 什么是Markdown?
249
+
250
+ Markdown是一种在网络上组织文本的方式. 你可以控制文档的显示; 文字格式化成粗体或斜体, 添加图片和创建列表也是Markdown可以做到的一部分事情. 更多的是, Markdown仅仅只是包含了一些如` # ` 或` * ` 之类非字母字符的普通文本.
251
+
252
+ 你可以在GitHub的绝大多数地方使用Markdown:
253
+
254
+ * Gists
255
+ * 在Issues和Pull Requests里的评论
256
+ * ` .md ` 和` .markdown ` 后缀的文件
257
+
258
+ ### 示例
259
+
260
+ https://guides.github.com/features/mastering-markdown/#examples
261
+
262
+ ### 语法指南
263
+
264
+ 以下是Markdown语法的简述, 你可以在GitHub.com或你自己的文本文件中使用.
265
+
266
+ #### 标题
267
+
268
+ # This is an <h1> tag
269
+ ## This is an <h2> tag
270
+ ###### This is an <h6> tag
271
+
272
+ #### 重点
273
+
274
+ *This text will be italic*
275
+ _This will also be italic_
276
+
277
+ \**This text will be bold**
278
+ \__This will also be bold__
279
+
280
+ *You **can** combine them*
281
+
282
+ #### 无序列表
283
+
284
+ * Item 1
285
+ * Item 2
286
+ * Item 2a
287
+ * Item 2b
288
+
289
+ #### 有序列表
290
+
291
+ 1. Item 1
292
+ 2. Item 2
293
+ 3. Item 3
294
+ * Item 3a
295
+ * Item 3b
296
+
297
+ #### 图片
298
+
299
+ \
300
+ Format: \
301
+
302
+ #### 链接
303
+
304
+ http://github.com - automatic!
305
+ \[GitHub](http://github.com)
306
+
307
+ #### 引用
308
+
309
+ As Kanye West said:
310
+
311
+ > We're living the future so
312
+ > the present is our past.
313
+
314
+ #### 内联代码
315
+
316
+ I think you should use an
317
+ \`<addr>` element here instead.
318
+
319
+ ### GitHub Flavored Markdown
320
+
321
+ GitHub.com使用自身版本的Markdown语法提供一些额外的有用功能, 这些可以使得在GitHub.com上更加容易写作.
322
+
323
+ 注意: GitHub Flavored Markdown的一些功能只能在Issues和Pull Requests的描述和评论中所使用. 这些包括@mentions , SHA-1哈希引用, Issues引用和Pull Requests引用.
324
+
325
+ #### 语言高亮
326
+
327
+ 以下是你使用GFM进行语法高亮的一个示例:
328
+
329
+ ```javascript
330
+ function fancyAlert(arg) {
331
+ if(arg) {
332
+ $.facebox({div:'#foo'})
333
+ }
334
+ }
335
+ ```
336
+
337
+ 你也可以仅仅简单地把你的代码缩进四个空格:
338
+
339
+ function fancyAlert(arg) {
340
+ if(arg) {
341
+ $.facebox({div:'#foo'})
342
+ }
343
+ }
344
+
345
+ 以下是一个Python代码没有语法高亮的示例:
346
+
347
+ def foo():
348
+ if not bar:
349
+ return True
350
+
351
+ #### 任务列表
352
+
353
+ - [x] @mentions, #refs, [links](), \**formatting**, and <del>tags</del> supported
354
+ - [x] list syntax required (any unordered or ordered list supported)
355
+ - [x] this is a complete item
356
+ - [ ] this is an incomplete item
357
+
358
+ #### 表格
359
+
360
+ 你可以用一个连字符` - ` (用于第一行)来集合和分隔单词, 同时用一个管道字符` | ` 来隔离每一列,从而创建表格:
361
+
362
+ First Header | Second Header
363
+ ------------ | -------------
364
+ Content from cell 1 | Content from cell 2
365
+ Content in the first column | Content in the second column
366
+
367
+ First Header | Second Header
368
+ ------------ | -------------
369
+ Content from cell 1 | Content from cell 2
370
+ Content in the first column | Content in the second column
371
+
372
+ #### SHA引用
E565
code>
373
+
374
+ 任何一个commit的SHA-1哈希值都会在GitHub上自动转化成一个指向commit的链接.
375
+
376
+ 16c999e8c71134401a78d4d46435517b2271d6ac
377
+ mojombo@16c999e8c71134401a78d4d46435517b2271d6ac
378
+ mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac
379
+
380
+ #### repository的Issue引用
381
+
382
+ 任何一个指向Issue或Pull Request的数字都会自动转化成一个链接.
383
+
384
+ #1
385
+ mojombo#1
386
+ mojombo/github-flavored-markdown#1
387
+
388
+ #### @mentions
389
+
390
+ 输入` @ ` , 之后再输入一个用户名, 将会提醒那个人过来并查看评论. 这个称作"@mention ", 因为你正在* 提到* 某人. 你也可以@mention 一个组织的团队.
391
+
392
+ #### 自动链接URL
393
+
394
+ 任何一个URL(如` http://www.github.com/ ` )都会自动转化成一个可以点击的链接.
395
+
396
+ #### 删除线
397
+
398
+ 任何一个包含在两个波浪字符之间的单词(如` ~~this~~ ` )将会被划掉.
399
+
400
+ #### Emoji
401
+
402
+ GitHub支持Emoji!:sparkles ::camel ::boom :
235
403
404
+ 请检验[ Emoji Cheat Sheet] ( http://www.emoji-cheat-sheet.com/ ) 来查看我们所支持的图片集合.
0 commit comments