myst-spec
Version:
MyST schema, testcases, and typescript types
187 lines (182 loc) • 4.42 kB
YAML
cases:
- title: Code directive
mdast:
type: root
children:
- type: mystDirective
name: code
args: python
options:
number-lines: 1
value: |-
def five():
return 5
children:
- type: code
lang: python
showLineNumbers: true
value: |-
def five():
return 5
myst: |-
```{code} python
:number-lines: 1
def five():
return 5
```
html: |-
<pre><code class="language-python">def five():
return 5
</code></pre>
- title: Code directive, starting line
mdast:
type: root
children:
- type: mystDirective
name: code
args: python
options:
name: My code
number-lines: 2
class: fun-code
value: |-
def five():
return 5
children:
- type: code
lang: python
identifier: my code
label: My code
class: fun-code
showLineNumbers: true
startingLineNumber: 2
value: |-
def five():
return 5
myst: |-
```{code} python
:name: My code
:number-lines: 2
:class: fun-code
def five():
return 5
```
html: |-
<pre><code id="my code" class="language-python fun-code">def five():
return 5
</code></pre>
- title: Code-block starting line
mdast:
type: root
children:
- type: mystDirective
name: code-block
args: python
options:
name: My code
linenos: true
lineno-start: 2
class: fun-code
value: |-
def five():
return 5
children:
- type: code
lang: python
identifier: my code
label: My code
class: fun-code
showLineNumbers: true
startingLineNumber: 2
value: |-
def five():
return 5
myst: |-
```{code-block} python
:name: My code
:linenos:
:lineno-start: 2
:class: fun-code
def five():
return 5
```
html: |-
<pre><code id="my code" class="language-python fun-code">def five():
return 5
</code></pre>
- title: Code-block directive shows line numbers without explicit linenos flag
mdast:
type: root
children:
- type: mystDirective
name: code-block
args: python
options:
lineno-start: 2
value: |-
def five():
return 5
children:
- type: code
lang: python
showLineNumbers: true
startingLineNumber: 2
value: |-
def five():
return 5
myst: |-
```{code-block} python
:lineno-start: 2
def five():
return 5
```
html: |-
<pre><code class="language-python">def five():
return 5
</code></pre>
- title: Code-block directive cannot spcify linenos without showing them
invalid: true
mdast:
type: root
children:
- type: code
lang: python
startingLineNumber: 2
value: |-
def five():
return 5
- title: Code-block directive - emphasize lines
mdast:
type: root
children:
- type: mystDirective
name: code-block
args: python
options:
emphasize-lines: 2, 3
value: |-
def five():
print('five')
return 5
children:
- type: code
lang: python
emphasizeLines:
- 2
- 3
value: |-
def five():
print('five')
return 5
myst: |-
```{code-block} python
:emphasize-lines: 2, 3
def five():
print('five')
return 5
```
html: |-
<pre><code class="language-python">def five():
print('five')
return 5
</code></pre>