reStructuredText(rst,reST)の基本は以下の通り。
- 記号を使って構造を作っていく
- 空行やインデント(行頭の空白)にも意味がある。
- 入れ子になったブロック(段落)では内側の文章のインデント(空白の桁数)を統一し、同じ位置(桁)から文章が始まるようにする。
- 同じ構造を作るにも、何種類かの記号を使うことが出来るものがある。その文書内で使う記号に統一が取れていれば、どれでもいい。
- 段落の見出し(HTMLのh1,h2,…相当)には「=」や「-」「#」「*」「^」「~」「”」といった記号を使う。
- 記号と見出しレベルには特定の関係はなく、使用した順番で決定される。
- 見出しの文章の上下にその記号を並べる(上下で囲むイメージ)か、文章の下に記号を並べる(アンダーラインの様なイメージ)は別のレベルとして認識される。
- どちらの場合でも、記号は文章の文字数(バイト数)以上にする必要がある。
| 例1(Sphinxで説明されているPythonドキュメントの慣例): |
| | ##################
Part
##################
*******************
Chapter
*******************
Section
===========================
Subsection
---------------------------
Subsubsection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Paragraph
"""""""""""""""""""""""""""""""""
|
- 表の枠線の長さは列の要素と同じ長さ。
- 表中の +--+ でセルの連結を調整できる。
- 列の間は2マス以上開ける。
- ラインの長さの正確な制限は不明。以下のルールがありそう。
- 各列はヘッダの要素以上の長さが必要。
- 各列要素の始点はラインの始点と合わせる。
- \ で空白セルを表す。
- 途中でセルを結合すると変更できない感じ(要確認)
===== =====
col 1 col 2
===== =====
1 Second column of row 1.
2 Second column of row 2.
Second line of paragraph.
Each column must have 4 spaces.
But header and lines can be separated 1 space.
3 - Second column of row 3.
- Second item in bullet
list (row 3, column 2).
\ Row 4; column 1 will be empty.
Row 5 has 1 column.
============
| col 1 |
col 2 |
| 1 |
Second column of row 1. |
| 2 |
Second column of row 2.
Second line of paragraph.
Each column must have 4 spaces.
But header and lines can be separated 1 space. |
| 3 |
- Second column of row 3.
- Second item in bullet
list (row 3, column 2).
|
|
Row 4; column 1 will be empty. |
| Row 5 has 1 column. |
.. csv-table:: title
:header: header1,header2,header3
:widths: 20,25,30
cell1,cell2,cell3
cell3,,cell4
title
| header1 |
header2 |
header3 |
| cell1 |
cell2 |
cell3 |
| cell3 |
|
cell4 |
.. list-table:: title
:widths: 15 10 30
:header-rows: 1
* - header1
- header2
- header3
* - r1cell1
- r1cell2
- r1cell3
* - r2cell1
- r2cell2
- r2cell3
r2cell3-cont
title
| header1 |
header2 |
header3 |
| r1cell1 |
r1cell2 |
r1cell3 |
| r2cell1 |
r2cell2 |
r2cell3
r2cell3-cont |
- 英語は単語が分かれるので意識しなくてよいが、日本語の場合は忘れがち。