@@ -31,16 +31,54 @@ try 'backslashes in code(1)' ' printf "%s: \n", $1;' \
31
31
try ' backslashes in code(2)' ' `printf "%s: \n", $1;`' \
32
32
' <p><code>printf "%s: \n", $1;</code></p>'
33
33
34
- if . /markdown -V | grep FENCED-CODE > /dev/ null; then
34
+ try ' fenced code disabled backtick' \
35
+ ' ```
35
36
36
- try ' fenced code block' \
37
+ unrecognized code!
38
+ ```' \
39
+ ' <p>```</p>
40
+
41
+ <p>unrecognized code!
42
+ ```</p>'
43
+
44
+ # no <pre/> proves it’s the inline variant of `code` delimitation
45
+ try ' fenced code disabled backtick as inline code' \
46
+ ' ```
47
+ inline code?
48
+ ```' \
49
+ ' <p><code>
50
+ inline code?
51
+ </code></p>'
52
+
53
+ try ' fenced code disabled tilde' \
54
+ ' ~~~
55
+
56
+ unrecognized code!
57
+ ~~~' \
58
+ ' <p>~~~</p>
59
+
60
+ <p>unrecognized code!
61
+ ~~~</p>'
62
+
63
+ try -ffencedcode ' fenced code block with blank lines' \
37
64
' ~~~
38
65
code!
66
+
67
+ still code!
39
68
~~~' \
40
69
' <pre><code>code!
70
+
71
+ still code!
41
72
</code></pre>'
42
73
43
- try ' fenced code block in list' \
74
+ try -ffencedcode ' fenced code block' \
75
+ ' ~~~
76
+ code!
77
+ ~~~' \
78
+ ' <pre><code>code!
79
+ </code></pre>'
80
+
81
+ try -ffencedcode ' fenced code block in list' \
44
82
' 1. ~~~
45
83
code block
46
84
~~~' \
@@ -49,20 +87,20 @@ code block
49
87
</code></pre></li>
50
88
</ol>'
51
89
52
- try ' fenced code block in blockquote' \
90
+ try -ffencedcode ' fenced code block in blockquote' \
53
91
' >~~~
54
92
code
55
93
~~~' \
56
94
' <blockquote><pre><code>code
57
95
</code></pre></blockquote>'
58
96
59
- try ' unterminated fenced code block' \
97
+ try -ffencedcode ' unterminated fenced code block' \
60
98
' ~~~
61
99
code' \
62
100
' <p>~~~
63
101
code</p>'
64
102
65
- try ' fenced code block with tildes' \
103
+ try -ffencedcode ' fenced code block with tildes' \
66
104
' ~~~~~
67
105
~~~
68
106
code with tildes
@@ -73,7 +111,7 @@ code with tildes
73
111
~~~
74
112
</code></pre>'
75
113
76
- try ' paragraph with trailing fenced block' \
114
+ try -ffencedcode ' paragraph with trailing fenced block' \
77
115
' text text text
78
116
text text text
79
117
~~~
@@ -85,7 +123,69 @@ text text text
85
123
code code code?
86
124
~~~</p>'
87
125
88
- fi
126
+ try -ffencedcode ' fenced code blocks with backtick delimiters' \
127
+ ' ```
128
+ code
129
+ ```' \
130
+ ' <pre><code>code
131
+ </code></pre>'
132
+
133
+ try -ffencedcode ' fenced code block with mismatched delimters' \
134
+ ' ```
135
+ code
136
+ ~~~' \
137
+ ' <p>```
138
+ code
139
+ ~~~</p>'
140
+
141
+ try -ffencedcode ' fenced code block with lang attribute' \
142
+ ' ```lang
143
+ code
144
+ ```' \
145
+ ' <pre><code class="lang">code
146
+ </code></pre>'
147
+
148
+ try -ffencedcode ' fenced code block with lang-name attribute' \
149
+ ' ```lang-name
150
+ code
151
+ ```' \
152
+ ' <pre><code class="lang-name">code
153
+ </code></pre>'
154
+
155
+ try -ffencedcode ' fenced code block with lang_name attribute' \
156
+ ' ```lang_name
157
+ code
158
+ ```' \
159
+ ' <pre><code class="lang_name">code
160
+ </code></pre>'
161
+
162
+ try -ffencedcode ' fenced code block with lang attribute and space' \
163
+ ' ``` lang
164
+ code
165
+ ```' \
166
+ ' <pre><code class="lang">code
167
+ </code></pre>'
168
+
169
+ try -ffencedcode ' fenced code block with lang attribute and multiple spaces' \
170
+ ' ``` lang
171
+ code
172
+ ```' \
173
+ ' <pre><code class="lang">code
174
+ </code></pre>'
175
+
176
+ try -ffencedcode ' fenced code block with lang-name attribute and space' \
177
+ ' ``` lang-name
178
+ code
179
+ ```' \
180
+ ' <pre><code class="lang-name">code
181
+ </code></pre>'
182
+
183
+ try -ffencedcode ' fenced code block with lang_name attribute and space' \
184
+ ' ``` lang_name
185
+ code
186
+ ```' \
187
+ ' <pre><code class="lang_name">code
188
+ </code></pre>'
89
189
90
190
summary $0
91
191
exit $ rc
0 commit comments