Markdown構文ガイド

ドキュメントフォーマットの基本構文

概要

Markdownは、プレーンテキストにフォーマットを加える軽量マークアップ言語です。2004年John Gruber考案、今や世界で広く使われています。

MarkdownはWYSIWYGエディタとは異なります。Wordのようにボタンでフォーマットするのではなく、テキストに構文を加えて、どの語句をどう見せるか指定します。

見出し

見出しは語やフレーズの前に#を置きます。#の数がレベル(例:###でレベル3)になります。

Markdown
HTML
表示結果
# Heading level 1
<h1>Heading level 1</h1>

Heading level 1

## Heading level 2
<h2>Heading level 2</h2>

Heading level 2

### Heading level 3
<h3>Heading level 3</h3>

Heading level 3

#### Heading level 4
<h4>Heading level 4</h4>

Heading level 4

##### Heading level 5
<h5>Heading level 5</h5>
Heading level 5
###### Heading level 6
<h6>Heading level 6</h6>
Heading level 6

段落

段落は空行で区切ります。

Markdown
HTML
表示結果
I really like using Markdown.

It lets me write easily.
<p>I really like using Markdown.</p>
<p>It lets me write easily.</p>

I really like using Markdown.

It lets me write easily.

改行

改行するには、行末にスペースを2つ以上入れてEnter。

Markdown
HTML
表示結果
This is the first line.
And this is the second line.
<p>This is the first line.<br>
And this is the second line.</p>

This is the first line.
And this is the second line.

強調

太字または斜体で強調できます。

太字

語やフレーズの前後に**または__を置く。

Markdown
HTML
表示結果
I just love **bold text**.
I just love <strong>bold text</strong>.

I just love bold text.

I just love __bold text__.
I just love <strong>bold text</strong>.

I just love bold text.

斜体

語やフレーズの前後に*または_を置く。

Markdown
HTML
表示結果
The *cat* meows.
The <em>cat</em> meows.

The cat meows.

The _cat_ meows.
The <em>cat</em> meows.

The cat meows.

太字と斜体

前後に***または___を置く。

Markdown
HTML
表示結果
This text is ***really important***.
This text is <strong><em>really important</em></strong>.

This text is really important.

This text is ___really important___.
This text is <strong><em>really important</em></strong>.

This text is really important.

引用

段落の前に>を置く。

Markdown
HTML
表示結果
> Dorothy followed her through many of the beautiful rooms in her castle.
<blockquote><p>Dorothy followed her through many of the beautiful rooms in her castle.</p></blockquote>

Dorothy followed her through many of the beautiful rooms in her castle.

ネストした引用

ネストする段落の前に>>を置く。

Markdown
表示結果
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

リスト

番号付き・番号なしリストを作れます。

番号付きリスト

数字とピリオドで各行を始める。1から始める。

Markdown
HTML
表示結果
1. First item
2. Second item
3. Third item
4. Fourth item
<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ol>
  1. First item
  2. Second item
  3. Third item
  4. Fourth item

番号なしリスト

各行を-、*、+のいずれかで始める。

Markdown
HTML
表示結果
- First item
- Second item
- Third item
- Fourth item
<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ul>
  • First item
  • Second item
  • Third item
  • Fourth item

コード

語やフレーズをバッククォート`で囲む。

Markdown
HTML
表示結果
At the command prompt, type `nano`.
At the command prompt, type <code>nano</code>.

At the command prompt, type nano.

コードブロック

各行を4スペース以上またはタブでインデントするか、```でブロックの前後を囲む。

Markdown
表示結果
```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}
```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}

水平線

***、---、___のいずれかだけの行を作る。

Markdown
HTML
表示結果
***
<hr>

---
<hr>

___
<hr>

画像

!の後に[代替テキスト]と(URLまたはパス)。オプションでタイトルをダブルクォートで。

Markdown
HTML
表示結果
![The San Juan Mountains](https://mdg.imgix.net/assets/images/san-juan-mountains.jpg "San Juan Mountains")
<img src="https://mdg.imgix.net/assets/images/san-juan-mountains.jpg" alt="The San Juan Mountains" title="San Juan Mountains">
The San Juan Mountains

エスケープ

フォーマット用の文字をそのまま表示するには、前にバックスラッシュ\を置く。

Markdown
表示結果
\* Without the backslash, this would be a bullet in an unordered list.

* Without the backslash, this would be a bullet in an unordered list.

エスケープできる文字

バックスラッシュでエスケープできる例:

\backslash
`backtick
*asterisk
_underscore
{ }curly braces
[ ]brackets
( )parentheses
#pound sign
+plus sign
-minus sign (hyphen)
.dot
!exclamation mark
|pipe

---で各列のヘッダーを作り、|で列を区切る。

Markdown
表示結果
| Syntax    | Description |
| --------- | ----------- |
| Header    | Title       |
| Paragraph | Text        |
SyntaxDescription
HeaderTitle
ParagraphText

整列

ヘッダー行の---の左・右・両側に:を付けて整列。

Markdown
表示結果
| Align Left | Align Center | Align Right |
| :--- | :---: | ---: |
| This | This | This |
| column | column | column |
| will | will | will |
| align | align | align |
| left | center | right |
左揃え中央揃え右揃え
ThisThisThis
columncolumncolumn
willwillwill
alignalignalign
leftcenterright