UNPKG

4.34 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 cannot spcify linenos without showing them
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 value: |-
126 def five():
127 return 5
128 myst: |-
129 ```{code-block} python
130 :lineno-start: 2
131 def five():
132 return 5
133 ```
134 html: |-
135 <pre><code class="language-python">def five():
136 return 5
137 </code></pre>
138 - title: Code-block directive cannot spcify linenos without showing them
139 invalid: true
140 mdast:
141 type: root
142 children:
143 - type: code
144 lang: python
145 startingLineNumber: 2
146 value: |-
147 def five():
148 return 5
149
150 - title: Code-block directive - emphasize lines
151 mdast:
152 type: root
153 children:
154 - type: mystDirective
155 name: code-block
156 args: python
157 options:
158 emphasize-lines: 2, 3
159 value: |-
160 def five():
161 print('five')
162 return 5
163 children:
164 - type: code
165 lang: python
166 emphasizeLines:
167 - 2
168 - 3
169 value: |-
170 def five():
171 print('five')
172 return 5
173 myst: |-
174 ```{code-block} python
175 :emphasize-lines: 2, 3
176 def five():
177 print('five')
178 return 5
179 ```
180 html: |-
181 <pre><code class="language-python">def five():
182 print('five')
183 return 5
184 </code></pre>