Skip to content

Commit 701243e

Browse files
committed
fix markdown quote
1 parent 01ac47d commit 701243e

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

lib/syntax/block0.ml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ struct
2828
let md_blockquote =
2929
char '>'
3030
*> lines_while
31-
( spaces *> optional (char '>') *> spaces *> line >>= fun line ->
32-
if
33-
not
34-
(starts_with line "- " || starts_with line "# "
35-
|| starts_with line "id:: " || line = "-" || line = "#")
36-
then
37-
return line
38-
else
39-
fail "new block" )
31+
(spaces *> char '>' *> spaces *> eol *> return ""
32+
<|> ( spaces *> optional (char '>') *> spaces *> line >>= fun line ->
33+
if
34+
not
35+
(starts_with line "- " || starts_with line "# "
36+
|| starts_with line "id:: " || line = "-" || line = "#")
37+
then
38+
return line
39+
else
40+
fail "new block" ))
4041
<?> "markdown blockquote"
4142

4243
let displayed_math =

test/test_markdown.ml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,29 @@ let block =
775775
; I.Break_Line
776776
]
777777
]) )
778+
; ( "multi lines (2)"
779+
, `Quick
780+
, check_aux ">foo\nbar"
781+
(Quote
782+
[ paragraph
783+
[ I.Plain "foo"
784+
; I.Break_Line
785+
; I.Plain "bar"
786+
; I.Break_Line
787+
]
788+
]) )
789+
; ( "multi lines (3)"
790+
, `Quick
791+
, check_aux ">foo\n>\n>bar"
792+
(Quote
793+
[ paragraph
794+
[ I.Plain "foo"
795+
; I.Break_Line
796+
; I.Break_Line
797+
; I.Plain "bar"
798+
; I.Break_Line
799+
]
800+
]) )
778801
] )
779802
; ( "latex_env"
780803
, testcases

0 commit comments

Comments
 (0)