Tutorial on Markdown with GitLab

Gitlab

This is a tutorial to Markdown written in Markdown:) Btw Jianshu is a nice platform to try and use Markdown!

Introduction

Markdown (.md) is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats using a tool by the same name.

Markdown Syntax

Heading

There are five common header levels.

# Head 1

Head 1

## head 2

head 2

### head 3

head 3


Text attributes

*italic*, **bold**, `monospace`

italic, bold, monospace


Escape

Use \ to escape markdown characters like \*, \-, \*\*

Use \ to escape markdown characters like *, -, **


Reference

A [link to Markdown Wikipedia](https://en.wikipedia.org/wiki/Markdown).

A link to Markdown Wikipedia.

![A image in Markdown Wikipedia](http://upload-images.jianshu.io/upload_images/6532-274b4a96cfc311da.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
A image in Markdown Wikipedia

For external files like images you want to reference in a Markdown file, sometimes it's better to find a image bed to store in case of outdated (broken) links.

You may find it inconvenient to use absolute paths to reference external files, especially when you upload markdown documents from local to GitLab, or change your directory structure. So relative path may be a better choice.


Paragraph

Paragraphs are separated

by a blank line.

Paragraphs are separated

by a blank line.


List

Bullet list:

  - apples
    - green apples
  - oranges
  - pears

Numbered list:

  1. apples
  2. oranges
  3. pears

Bullet list:

  • apples
    • green apples
  • oranges
  • pears

Numbered list:

  1. apples
  2. oranges
  3. pears

Quote

> Quote 1
> Quote 2

Quote 1
Quote 2

Code Highlight

```python # Gitlab's extended syntax allow you to specify the highlight language here
(code here)
```

def function():
    #indenting works just fine in the fenced code block
    s = "Python syntax highlighting"
    print s

Table

|hello|markdown|world|
|---|---|---|
|1|3.14|**1024**|
|2|*6.28*|2048|
hello markdown world
1 3.14 1024
2 6.28 2048

Writing Markdown

As markdown uses plain text formatting syntax, you can create a .md file and write in any kind of test editor, including GitLab itself:

Edit on GitLab

For those who demand a better offline writing experience, I recommend an open-source eidtor application called Atom. It supports code (including Markdown) highlighting and Markdown Preview (Ctrl + Shift + M):

Markdown in Atom

Watch out: Atom uses its own render, so you may not get the exact format as GitLab in Atom's previewer. You can adjust Atom's markdown to Github style (more compatible with GitLab) following this:

  1. Edit > Preferences (Linux), Atom > Preferences (macOS), or File > Preferences (Windows)
  2. Find markdown-preview in Packages
  3. settings > use GitHub.com style
Change Preview Style in Atom

Convert Markdown to PDF

There are different ways to convert Markdown to PDF. Some are easier to use while others have more beautiful format. Here we only introduce one easy way with Atom. First we need install a markdown-themeable-pdf package:

  1. Open Panel: Ctrl + Shift + P
  2. Settings View: Install Packages And Themes
  3. Search and install markdown-themeable-pdf

Then we only need to use Ctrl + Shift + E to convert Markdown. The PDF file would be in the same directory as the Markdown document. You can also install pdf-view package to allow reading PDF in Atom.

Watch out: if you reference files (excluding images) in the Markdown document files, you should make sure your paths have corresponding accessible sources.

Use Markdown on Gitlab

Is syntax the same?

GitLab (https://about.gitlab.com/) implements an extended markdown language, so there are some slight differences you may come across between standard syntax and GitLab Syntax, like code highlight and tables. For more details, please refer to GitLab's markdown help. GitLab can automatically render uploaded markdown files (.md).

How does it look?

On Gitlab, you'll see rendered Markdown documents directly. You can also check the plain text of your Markdown document on Gitlab (Raw mode):

view Markdown raw text on GitLab

Can I sync my markdown files?

You can use GitLab to maintain codes, markdown documents and other external files. As Gitlab uses Git to do version control of all files, it can keep all the historical versions of your documents. You can easily access any of them on Gitlab.

Gitlab allows us to edit and save files on its web page directly, but cannot upload / update a whole folder with one click. So if you want to edit your files and folders on your local machine, then sync to our GitLab document library, you should operate as following:

  • For non-technical users, use Sourcetree or other similar GUI application to interact with Gitlab's Git repo
  • For technical users, just use Git to do this (need to set SSH key or HTTP's id/password).

Some Advices

  • Markdown is more suitable for situations that do not need too complex format. For example, if you want to create a table sheet for a survey, you'd better use Microsoft Word. You can also try to create a table with Markdown, and copy the formatted table to Word for further editing.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末徙缴,一起剝皮案震驚了整個濱河市坟募,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌盖溺,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,378評論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件垃喊,死亡現(xiàn)場離奇詭異称开,居然都是意外死亡,警方通過查閱死者的電腦和手機搓侄,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,970評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來话速,“玉大人讶踪,你說我怎么就攤上這事〔唇唬” “怎么了俊柔?”我有些...
    開封第一講書人閱讀 168,983評論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長活合。 經(jīng)常有香客問我雏婶,道長,這世上最難降的妖魔是什么白指? 我笑而不...
    開封第一講書人閱讀 59,938評論 1 299
  • 正文 為了忘掉前任留晚,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘错维。我一直安慰自己奖地,他們只是感情好,可當我...
    茶點故事閱讀 68,955評論 6 398
  • 文/花漫 我一把揭開白布赋焕。 她就那樣靜靜地躺著参歹,像睡著了一般。 火紅的嫁衣襯著肌膚如雪隆判。 梳的紋絲不亂的頭發(fā)上犬庇,一...
    開封第一講書人閱讀 52,549評論 1 312
  • 那天,我揣著相機與錄音侨嘀,去河邊找鬼臭挽。 笑死,一個胖子當著我的面吹牛咬腕,可吹牛的內(nèi)容都是我干的欢峰。 我是一名探鬼主播,決...
    沈念sama閱讀 41,063評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼涨共,長吁一口氣:“原來是場噩夢啊……” “哼纽帖!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起举反,我...
    開封第一講書人閱讀 39,991評論 0 277
  • 序言:老撾萬榮一對情侶失蹤懊直,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后照筑,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體吹截,經(jīng)...
    沈念sama閱讀 46,522評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡瘦陈,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,604評論 3 342
  • 正文 我和宋清朗相戀三年凝危,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片晨逝。...
    茶點故事閱讀 40,742評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡蛾默,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出捉貌,到底是詐尸還是另有隱情支鸡,我是刑警寧澤,帶...
    沈念sama閱讀 36,413評論 5 351
  • 正文 年R本政府宣布趁窃,位于F島的核電站牧挣,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏醒陆。R本人自食惡果不足惜瀑构,卻給世界環(huán)境...
    茶點故事閱讀 42,094評論 3 335
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望刨摩。 院中可真熱鬧寺晌,春花似錦世吨、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,572評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至陆赋,卻和暖如春沐祷,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背奏甫。 一陣腳步聲響...
    開封第一講書人閱讀 33,671評論 1 274
  • 我被黑心中介騙來泰國打工戈轿, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人阵子。 一個月前我還...
    沈念sama閱讀 49,159評論 3 378
  • 正文 我出身青樓思杯,卻偏偏與公主長得像,于是被迫代替她去往敵國和親挠进。 傳聞我的和親對象是個殘疾皇子色乾,可洞房花燭夜當晚...
    茶點故事閱讀 45,747評論 2 361

推薦閱讀更多精彩內(nèi)容