myst-spec
Version:
MyST schema, testcases, and typescript types
214 lines (208 loc) • 6.42 kB
YAML
cases:
- title: Basic table
id: table
mdast:
type: root
children:
- type: table
children:
- type: tableRow
children:
- type: tableCell
header: true
align: left
children:
- type: text
value: header 1
- type: tableCell
header: true
align: right
children:
- type: text
value: header 2
- type: tableRow
children:
- type: tableCell
align: left
children:
- type: text
value: '3'
- type: tableCell
align: right
children:
- type: text
value: '4'
myst: |-
| header 1 | header 2 |
|:---|---:|
| 3 | 4 |
html: |-
<table>
<thead>
<tr>
<th>header 1</th>
<th>header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>3</td>
<td>4</td>
</tr>
</tbody>
</table>
latex: |-
\begin{tabular}{*{2}{c}}
\hline
header 1 & header 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
- title: Basic list table
mdast:
type: root
children:
- type: mystDirective
name: list-table
args: Caption *text*
options:
name: my-table
header-rows: 1
align: center
class: myclass
value: |-
* - Head 1, Column 1
- Head 1, Column 2
- Head 1, Column 3
* - Row 1, Column 1
- Row 1, Column 2
- Row 1, Column 3
* - Row 2, Column 1
- Row 2, Column 2
- Row 2, **Column 3**
children:
- type: container
kind: table
identifier: my-table
label: my-table
class: myclass
children:
- type: caption
children:
- type: paragraph
children:
- type: text
value: 'Caption '
- type: emphasis
children:
- type: text
value: text
- type: table
align: center
children:
- type: tableRow
children:
- type: tableCell
header: true
children:
- type: text
value: Head 1, Column 1
- type: tableCell
header: true
children:
- type: text
value: Head 1, Column 2
- type: tableCell
header: true
children:
- type: text
value: Head 1, Column 3
- type: tableRow
children:
- type: tableCell
children:
- type: text
value: Row 1, Column 1
- type: tableCell
children:
- type: text
value: Row 1, Column 2
- type: tableCell
children:
- type: text
value: Row 1, Column 3
- type: tableRow
children:
- type: tableCell
children:
- type: text
value: Row 2, Column 1
- type: tableCell
children:
- type: text
value: Row 2, Column 2
- type: tableCell
children:
- type: text
value: 'Row 2, '
- type: strong
children:
- type: text
value: Column 3
myst: |-
```{list-table} Caption *text*
:name: my-table
:header-rows: 1
:align: center
:class: myclass
* - Head 1, Column 1
- Head 1, Column 2
- Head 1, Column 3
* - Row 1, Column 1
- Row 1, Column 2
- Row 1, Column 3
* - Row 2, Column 1
- Row 2, Column 2
- Row 2, **Column 3**
```
html: |-
<figure id="my-table" class="numbered myclass">
<figcaption>
<p><span class="caption-number">Table 1</span>Caption <em>text</em></p>
</figcaption>
<table align="center">
<thead>
<tr>
<th>Head 1, Column 1</th>
<th>Head 1, Column 2</th>
<th>Head 1, Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
<td>Row 1, Column 3</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
<td>Row 2, <strong>Column 3</strong></td>
</tr>
</tbody>
</table>
</figure>
latex: |-
\begin{table}[!htbp]
\centering
\caption*{Caption \textit{text}}
\begin{tabular}{*{3}{c}}
\hline
Head 1, Column 1 & Head 1, Column 1 & Head 3, Column 3 \\
\hline
Row 1, Column 1 & Row 1, Column 2 & Row 1, Column 3 \\
Row 2, Column 1 & Row 2, Column 2 & Row 2, \textbf{Column 3} \\
\hline
\end{tabular}
\end{table}