File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,8 @@ isfence(line) =
521
521
startswith (line. val, " ```" ) || startswith (line. val, " ~~~" )
522
522
isindent (line) =
523
523
startswith (line. val, " " ^ 4 )
524
+ isadmonition (line) =
525
+ startswith (line. val, " !!!" )
524
526
525
527
function unindent (line)
526
528
val = line. val[5 : end ]
@@ -558,6 +560,11 @@ function parsemd!(stack::Vector{TextBlock})
558
560
end
559
561
reverse! (jlstack)
560
562
append! (suite, parsejl! (jlstack))
563
+ elseif isadmonition (line)
564
+ # Skip an indented admonition block.
565
+ while ! isempty (stack) && (isindent (stack[end ]) || isblank (stack[end ]))
566
+ pop! (stack)
567
+ end
561
568
end
562
569
end
563
570
return suite
Original file line number Diff line number Diff line change @@ -254,6 +254,18 @@ A fenced code block with an explicit language indicator is ignored.
254
254
"""))
255
255
#-> NarrativeTest.AbstractTestCase[]
256
256
257
+ An indented admonition block will be ignored.
258
+
259
+ parsemd(
260
+ @__FILE__,
261
+ IOBuffer("""
262
+ !!! warning
263
+
264
+ This is an admonition block,
265
+ not a Julia code.
266
+ """))
267
+ #-> NarrativeTest.AbstractTestCase[]
268
+
257
269
It is an error if a fenced code block is not closed.
258
270
259
271
suite = parsemd(
You can’t perform that action at this time.
0 commit comments