Markdown

GitLab Flavored Markdown (GFM)

Note: Not all of the GitLab-specific extensions to Markdown that are described in this document currently work on our documentation website.

For the best result, we encourage you to check this document out as rendered by GitLab: markdown.md

GitLab uses the Redcarpet Ruby library for Markdown processing.

GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few significant ways to add some useful functionality. It was inspired by GitHub Flavored Markdown.

GFM は以下の場所で使うことができます。 the following areas:

  • コメント
  • 課題
  • マージリクエスト
  • マイルストーン
  • snippets (the snippet must be named with a .md extension)
  • Wikiページ
  • markdown documents inside the repository

You can also use other rich text files in GitLab. You might have to install a dependency to do so. Please see the github-markup gem readme for more information.

改行

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#newlines

GFMは 段落と改行の取り扱い での Markdown 仕様にならっています。

段落は単純に1行以上の空行で分けられた、1行以上のテキストです。 ラインブレーク、ソフトリターンを使うには行末に2つ以上のスペースを入れます。:

Roses are red [followed by two or more spaces]
Violets are blue

Sugar is sweet

Roses are red
Violets are blue

Sugar is sweet

単語内の複数のアンダースコア

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#multiple-underscores-in-words

It is not reasonable to italicize just part of a word, especially when you're dealing with code and names that often appear with multiple underscores. Therefore, GFM ignores multiple underscores in words:

perform_complicated_task

do_this_and_do_that_and_another_thing

perform_complicated_task

do_this_and_do_that_and_another_thing

URLの自動リンク

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#url-auto-linking

GFM will autolink almost any URL you copy and paste into your text:

* https://www.google.com
* https://google.com/
* ftp://ftp.us.debian.org/debian/
* smb://foo/bar/baz
* irc://irc.freenode.net/gitlab
* http://localhost:3000

Multiline Blockquote

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#multiline-blockquote

On top of standard Markdown blockquotes, which require prepending > to quoted lines, GFM supports multiline blockquotes fenced by >>>:

>>>
If you paste a message from somewhere else

that

spans

multiple lines,

you can quote that without having to manually prepend `>` to every line!
>>>

If you paste a message from somewhere else

that

spans

multiple lines,

you can quote that without having to manually prepend > to every line!

コードとシンタックスハイライト

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#code-and-syntax-highlighting

GitLab uses the Rouge Ruby library for syntax highlighting. For a list of supported languages visit the Rouge website.

Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. Only the fenced code blocks support syntax highlighting:

インラインの`コード`は`バッククオート`で括られています。

インラインのコードバッククオートで括られています。

Example:

```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```

```python
def function():
    #仕切られたコードブロックではインデントが有効です
    s = "Python syntax highlighting"
    print s
```

```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```

```
言語が示されていない場合は、シンタックスハイライトされません。
s = "There is no highlighting for this."
But let's throw in a <b>tag</b>.
```

これは次のように表示されます。

var s = "JavaScript syntax highlighting";
alert(s);
def function():
    #仕切られたコードブロックではインデントが有効です
    s = "Python syntax highlighting"
    print s
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
言語が示されていない場合は、シンタックスハイライトされません。
s = "There is no highlighting for this."
But let's throw in a <b>tag</b>.

Inline Diff

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#inline-diff

With inline diffs tags you can display additions or deletions .

The wrapping tags can be either curly braces or square brackets additions or deletions .

However the wrapping tags cannot be mixed as such:

  • {+ additions +]
  • [+ additions +}
  • {- deletions -]
  • [- deletions -}

Emoji

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#emoji

時には、 :monkey: になり :speech_balloon: に :star2: を追加したいこともあるでしょう。そんなあなたにプレゼントがあります。

:zap: あなたはGFMがサポートされた場所ならどこでも、絵文字を使うことができます :v:

:bug: の指摘や :speak_no_evil: パッチの警告に使うこともできます。そして、もし誰かが本当に :snail: なコードを改善したら、彼らに :birthday: を送りましょう。皆あなたを :heart: になるでしょう。

あなたが絵文字の初心者だとしても、 :fearful: にならないでください。あなたも簡単に絵文字の :family: に入ることができます。サポートされたコードを使うだけです。

サポートされている絵文字コードの一覧は、 [Emoji Cheat Sheet](http://emoji.codes) を確認してください。 :thumbsup:

時には、 :monkey: になり :speech_balloon::star2: を追加したいこともあるでしょう。そんなあなたにプレゼントがあります。

:zap: あなたはGFMがサポートされた場所ならどこでも、絵文字を使うことができます :v:

:bug: の指摘や :speak_no_evil: パッチの警告に使うこともできます。そして、もし誰かが本当に :snail: なコードを改善したら、彼らに :birthday: を送りましょう。皆あなたを :heart: になるでしょう。

あなたが絵文字の初心者だとしても、 :fearful: にならないでください。あなたも簡単に絵文字の :family: に入ることができます。サポートされたコードを使うだけです。

サポートされている絵文字コードの一覧は、 Emoji Cheat Sheet を確認してください。 :thumbsup:

GitLabでの特別な参照

GFM は特別な参照を認識します。

例えばプロジェクト内のチームメンバー、課題、コミットメッセージを簡単に参照することができます。

GFM は参照をリンクに変換するため、それらの参照に対して簡単にナビゲーションすることができます。

GFM は以下を認識します。

入力 参照
@user_name 特定のユーザ
@group_name 特定のグループ
@all チーム全体
#123 課題
!123 マージリクエスト
$123 スニペット
~123 ラベル by ID
~bug 1単語ラベル by 名前
~"feature request" 複数単語ラベル by 名前
%123 milestone by ID
%v1.23 one-word milestone by name
%"release candidate" multi-word milestone by name
9ba12248 特定のコミット
9ba12248...b19a04f5 コミット範囲比較
[README](doc/README) リポジトリ内のファイル

GFM はクロスプロジェクトも認識します。

入力 参照
namespace/project#123 課題
namespace/project!123 マージリクエスト
namespace/project%123 milestone
namespace/project$123 スニペット
namespace/project@9ba12248 特定のコミット
namespace/project@9ba12248...b19a04f5 コミット範囲比較
namespace/project~"Some label" issues with given label

It also has a shorthand version to reference other projects from the same namespace:

入力 参照
project#123 課題
project!123 マージリクエスト
project%123 milestone
project$123 スニペット
project@9ba12248 特定のコミット
project@9ba12248...b19a04f5 コミット範囲比較
project~"Some label" issues with given label

Task Lists

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#task-lists

You can add task lists to issues, merge requests and comments. To create a task list, add a specially-formatted Markdown list, like so:

- [x] Completed task
- [ ] Incomplete task
    - [ ] Sub-task 1
    - [x] Sub-task 2
    - [ ] Sub-task 3
  • Completed task
  • Incomplete task
    • Sub-task 1
    • Sub-task 2
    • Sub-task 3

Task lists can only be created in descriptions, not in titles. Task item state can be managed by editing the description's Markdown or by toggling the rendered check boxes.

Videos

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#videos

Image tags with a video extension are automatically converted to a video player.

The valid video extensions are .mp4, .m4v, .mov, .webm, and .ogv.

Here's a sample video:

![Sample Video](img/markdown_video.mp4)

Here's a sample video:

Math

If this is not rendered correctly, see https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#math

It is possible to have math written with the LaTeX syntax rendered using KaTeX.

Math written inside $``$ will be rendered inline with the text.

Math written inside triple back quotes, with the language declared as math, will be rendered on a separate line.

Example:

This math is inline $`a^2+b^2=c^2`$.

This is on a separate line
```math
a^2+b^2=c^2
```

Becomes:

This math is inline a^2+b^2=c^2.

This is on a separate line

a^2+b^2=c^2

Be advised that KaTeX only supports a subset of LaTeX.

Note: This also works for the asciidoctor :stem: latexmath. For details see the asciidoctor user manual.

標準のMarkdown

ヘッダ

# H1
## H2
### H3
#### H4
##### H5
###### H6

H1とH2では下線を使ったスタイルも使うことができます。

H1の別表現
======

H2の別表現
------

ヘッダのIDとリンク

すべての Markdown からレンダリングされたヘッダは、コメントを除いて自動的にIDを取得します。

ヘッダへのリンクを誰かに知らせやすくするために、リンク上にカーソルをあてるとIDが表示されます。

コンテンツのヘッダから生成されたIDは以下のルールになっています。

  1. すべての文字が小文字に変換されます
  2. 単語構成文字以外のすべての文字(句読点、HTMLなど)は削除されます
  3. すべての空白はハイフンに変換されます
  4. 連続する2個以上のハイフンは1つのハイフンに変換されます
  5. 同じIDを持つヘッダがすでに生成されていた場合、1から開始する一意となる連番が付加されます

例:

# This header has spaces in it
## This header has a :thumbsup: in it
# This header has Unicode in it: 한글
## This header has spaces in it
### This header has spaces in it

これらは以下のようなIDのリンクに変換されます:

  1. this-header-has-spaces-in-it
  2. this-header-has-a-in-it
  3. this-header-has-unicode-in-it-한글
  4. this-header-has-spaces-in-it
  5. this-header-has-spaces-in-it-1

絵文字はヘッダのIDが生成される前に処理されるため、絵文字は画像に変換され、IDからは削除されます。

強調

強調(イタリック体)は *アスタリスク* や _アンダースコア_ で表現します。

さらに強い強調(太字)は **アスタリスク** or __アンダースコア__ で表現します。

組み合わせた強調は **アスタリスクと _アンダースコア_** のように表現します。

取消線には二つのチルダを使います。 ~~ここを削除~~

強調(イタリック体)は アスタリスクアンダースコア で表現します。

さらに強い強調(太字)は アスタリスク or アンダースコア で表現します。

組み合わせた強調は アスタリスクと アンダースコア のように表現します。

取消線には二つのチルダを使います。 ここを削除

リスト

1. 先頭のリスト項目
2. 別の項目
  * 番号のないサブリスト
1. 実際の番号は問題ではなく、数字であることが必要です
  1. 番号付きのサブリスト
4. さらに別の項目

* 番号のないリストはアスタリスクを使います
- またはマイナス
+ またはプラス
  1. 先頭のリスト項目
  2. 別の項目
    • 番号のないサブリスト
  3. 実際の番号は問題ではなく、数字であることが必要です
    1. 番号付きのサブリスト
  4. さらに別の項目
  • 番号のないリストはアスタリスクを使います
  • またはマイナス
  • またはプラス

If a list item contains multiple paragraphs, each subsequent paragraph should be indented with four spaces.

1.  First ordered list item

    Second paragraph of first item.
2.  Another item
  1. First ordered list item

    Second paragraph of first item.

  2. Another item

If the second paragraph isn't indented with four spaces, the second list item will be incorrectly labeled as 1.

1. 先頭のリスト項目

   Second paragraph of first item.
2. 別の項目
  1. 先頭のリスト項目

Second paragraph of first item.

  1. 別の項目

リンク

リンクを作るには、インラインスタイルとリファレンススタイルの二つの方法があります。

[インラインスタイルのリンクです](https://www.google.com)

[リファレンススタイルのリンクです][Arbitrary case-insensitive reference text]

[リポジトリのファイルへの相対パスでの参照です](LICENSE)

[I am an absolute reference within the repository](/doc/user/markdown.md)

[I link to the マイルストーン page](/../milestones)

[リファレンススタイルのリンク定義に番号を使うこともできます][1]

あるいは中身を空にして[リンクテキストをそのまま使う][]こともできます

リファレンスのリンク先は後に続けて書きます。

[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: https://www.reddit.com

インラインスタイルのリンクです

リファレンススタイルのリンクです

リポジトリのファイルへの相対パスでの参照です1

I am an absolute reference within the repository

I link to the マイルストーン page

リファレンススタイルのリンク定義に番号を使うこともできます

あるいは中身を空にして[リンクテキストをそのまま使う][]こともできます

リファレンスのリンク先は後に続けて書きます。

注意

相対パスのリンクでは、Wikiページ内のプロジェクトファイルやプロジェクトファイル内のWikiページを参照することはできません。理由は、GitLabではWikiが常に別のGitリポジトリに分けられているためです。例えば

[リファレンススタイルのリンクです](style)

は Wiki の Markdown ファイル内でのリンクならば wikis/style へリンクします。

画像

私たちのロゴです(マウスオーバーでタイトル文字列を表示します)。

インラインスタイル:
![alt text](img/markdown_logo.png)

リファレンススタイル:
![alt text1][logo]

[logo]: img/markdown_logo.png

私たちのロゴです。

インラインスタイル:

alt text

リファレンススタイル:

alt text

引用

> 引用はメールの返信をエミュレートするのに非常に便利です。
> この行は引用の一部です。

引用は終わります。

> これはとても長い行ですが正常にワードラップされて引用することができます。さあ、これが実際にワードラップしてくれることを皆が確かめられるように、十分に長く書き続けましょう。この引用にも **Markdown** を入れることができます。

引用はメールの返信をエミュレートするのに非常に便利です。 この行は引用の一部です。

引用は終わります。

これはとても長い行ですが正常にワードラップされて引用することができます。さあ、これが実際にワードラップしてくれることを皆が確かめられるように、十分に長く書き続けましょう。この引用にも Markdown を入れることができます。

Inline HTML

生のHTMLを Markdown で使うことができ、大半はうまく機能するでしょう。

See the documentation for HTML::Pipeline's SanitizationFilter class for the list of allowed HTML tags and attributes. In addition to the default SanitizationFilter whitelist, GitLab allows span elements.

<dl>
  <dt>定義リスト</dt>
  <dd>は時々使われるものです。</dd>

  <dt>HTMLでのMarkdown</dt>
  <dd>これは **うまく** 機能 *しません* 。HTML <em>タグ</em>を使ってください。</dd>
</dl>
定義リスト
は時々使われるものです。
HTMLでのMarkdown
これは **うまく** 機能 *しません* 。HTML タグを使ってください。

水平線

3つ以上...

---

ハイフン

***

アスタリスク

___

アンダースコア

3つ以上...


ハイフン


アスタリスク


アンダースコア

改行

基本的に、改行がどのような挙動になるか学ぶには、実験して発見することをおすすめします。 <Enter> を1回押し(改行を挿入し)、2回押し(2つの改行を挿入し)、何が起きるを見てください。すぐに知りたいことを知ることができるでしょう。"Markdownのトグル"が役に立ちます。

以下を試してみてください。

ここが最初の行です。

この行は2つの改行で上の行と分けられており *別の段落*になります。

この行も段落が分かれていますが...
この行は1つの改行だけで分けられているため、 *同じ段落* の別の行になります。

この行も段落が分かれており...  
前の行が2つのスペースで終わっているため、この行はこの行だけで表示されます。

ここが最初の行です。

この行は2つの改行で上の行と分けられており 別の段落になります。

This line is also begins a separate paragraph, but... この行は1つの改行だけで分けられているため、 同じ段落 の別の行になります。

この行も段落が分かれており...
前の行が2つのスペースで終わっているため、この行はこの行だけで表示されます。

テーブルはコアの Markdown の使用には含まれていませんが、GFMやここでのMarkdownではサポートされています。

| ヘッダ 1 | header 2 |
| -------- | -------- |
| セル 1   | cell 2   |
| セル 3   | cell 4   |

上記のコードでは、次のように表示されます。

ヘッダ 1 header 2
セル 1 cell 2
セル 3 cell 4

注意

表のヘッダとボディの間のダッシュの行は、それぞれの列に対して3つ以上のダッシュを含んでいる必要があります。

ヘッダ行にコロンを含めることで、列内のテキストの位置を揃えることができます。

| 左揃え       | 中央揃え | 右揃え        | 左揃え       | 中央揃え | 右揃え        |
| :----------- | :------: | ------------: | :----------- | :------: | ------------: |
| Cell 1       | Cell 2   | Cell 3        | Cell 4       | Cell 5   | Cell 6        |
| Cell 7       | Cell 8   | Cell 9        | Cell 10      | Cell 11  | Cell 12       |
左揃え 中央揃え 右揃え 左揃え 中央揃え 右揃え
Cell 1 Cell 2 Cell 3 Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9 Cell 10 Cell 11 Cell 12

Footnotes

You can add footnotes to your text as follows.[^2]
[^2]: This is my awesome footnote.

You can add footnotes to your text as follows.2

Wiki-specific Markdown

The following examples show how links inside wikis behave.

Wiki - Direct page link

A link which just includes the slug for a page will point to that page, at the base level of the wiki.

This snippet would link to a documentation page at the root of your wiki:

[Link to Documentation](documentation)

Wiki - Direct file link

Links with a file extension point to that file, relative to the current page.

If this snippet was placed on a page at <your_wiki>/documentation/related, it would link to <your_wiki>/documentation/file.md:

[Link to File](file.md)

Wiki - Hierarchical link

A link can be constructed relative to the current wiki page using ./<page>, ../<page>, etc.

  • If this snippet was placed on a page at <your_wiki>/documentation/main, it would link to <your_wiki>/documentation/related:

    [Link to Related Page](./related)
    
  • If this snippet was placed on a page at <your_wiki>/documentation/related/content, it would link to <your_wiki>/documentation/main:

    [Link to Related Page](../main)
    
  • If this snippet was placed on a page at <your_wiki>/documentation/main, it would link to <your_wiki>/documentation/related.md:

    [Link to Related Page](./related.md)
    
  • If this snippet was placed on a page at <your_wiki>/documentation/related/content, it would link to <your_wiki>/documentation/main.md:

    [Link to Related Page](../main.md)
    

Wiki - Root link

A link starting with a / is relative to the wiki root.

  • This snippet links to <wiki_root>/documentation:

    [Link to Related Page](/documentation)
    
  • This snippet links to <wiki_root>/miscellaneous.md:

    [Link to Related Page](/miscellaneous.md)
    

リファレンス

  • このドキュメントは Markdown-Cheatsheet に多いに参考にしています。
  • Daring Fireball の Markdown Syntax Guide は標準の Markdown について詳細に説明しているすばらしいリソースです。
  • Dillinger.io は標準の Markdown をテストできる便利なツールです。

  1. This link will be broken if you see this document from the Help page or docs.gitlab.com :leftwards_arrow_with_hook:

  2. This is my awesome footnote. :leftwards_arrow_with_hook: