UNPKG

4.42 kBYAMLView Raw
1cases:
2 - title: Code directive
3 mdast:
4 type: root
5 children:
6 - type: mystDirective
7 name: code
8 args: python
9 options:
10 number-lines: 1
11 value: |-
12 def five():
13 return 5
14 children:
15 - type: code
16 lang: python
17 showLineNumbers: true
18 value: |-
19 def five():
20 return 5
21 myst: |-
22 ```{code} python
23 :number-lines: 1
24 def five():
25 return 5
26 ```
27 html: |-
28 <pre><code class="language-python">def five():
29 return 5
30 </code></pre>
31
32 - title: Code directive, starting line
33 mdast:
34 type: root
35 children:
36 - type: mystDirective
37 name: code
38 args: python
39 options:
40 name: My code
41 number-lines: 2
42 class: fun-code
43 value: |-
44 def five():
45 return 5
46 children:
47 - type: code
48 lang: python
49 identifier: my code
50 label: My code
51 class: fun-code
52 showLineNumbers: true
53 startingLineNumber: 2
54 value: |-
55 def five():
56 return 5
57 myst: |-
58 ```{code} python
59 :name: My code
60 :number-lines: 2
61 :class: fun-code
62 def five():
63 return 5
64 ```
65 html: |-
66 <pre><code id="my code" class="language-python fun-code">def five():
67 return 5
68 </code></pre>
69
70 - title: Code-block starting line
71 mdast:
72 type: root
73 children:
74 - type: mystDirective
75 name: code-block
76 args: python
77 options:
78 name: My code
79 linenos: true
80 lineno-start: 2
81 class: fun-code
82 value: |-
83 def five():
84 return 5
85 children:
86 - type: code
87 lang: python
88 identifier: my code
89 label: My code
90 class: fun-code
91 showLineNumbers: true
92 startingLineNumber: 2
93 value: |-
94 def five():
95 return 5
96 myst: |-
97 ```{code-block} python
98 :name: My code
99 :linenos:
100 :lineno-start: 2
101 :class: fun-code
102 def five():
103 return 5
104 ```
105 html: |-
106 <pre><code id="my code" class="language-python fun-code">def five():
107 return 5
108 </code></pre>
109
110 - title: Code-block directive shows line numbers without explicit linenos flag
111 mdast:
112 type: root
113 children:
114 - type: mystDirective
115 name: code-block
116 args: python
117 options:
118 lineno-start: 2
119 value: |-
120 def five():
121 return 5
122 children:
123 - type: code
124 lang: python
125 showLineNumbers: true
126 startingLineNumber: 2
127 value: |-
128 def five():
129 return 5
130 myst: |-
131 ```{code-block} python
132 :lineno-start: 2
133 def five():
134 return 5
135 ```
136 html: |-
137 <pre><code class="language-python">def five():
138 return 5
139 </code></pre>
140 - title: Code-block directive cannot spcify linenos without showing them
141 invalid: true
142 mdast:
143 type: root
144 children:
145 - type: code
146 lang: python
147 startingLineNumber: 2
148 value: |-
149 def five():
150 return 5
151
152 - title: Code-block directive - emphasize lines
153 mdast:
154 type: root
155 children:
156 - type: mystDirective
157 name: code-block
158 args: python
159 options:
160 emphasize-lines: 2, 3
161 value: |-
162 def five():
163 print('five')
164 return 5
165 children:
166 - type: code
167 lang: python
168 emphasizeLines:
169 - 2
170 - 3
171 value: |-
172 def five():
173 print('five')
174 return 5
175 myst: |-
176 ```{code-block} python
177 :emphasize-lines: 2, 3
178 def five():
179 print('five')
180 return 5
181 ```
182 html: |-
183 <pre><code class="language-python">def five():
184 print('five')
185 return 5
186 </code></pre>