Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: markdown front matter property value tailed with space #122

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/syntax/markdown_front_matter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open Type
let kv_parse =
let key_parser = take_while1 (fun c -> c <> ':' && non_eol c) in
let sep_parser = char ':' <* spaces in
let value_parser = take_till is_eol <|> (end_of_input >>| fun _ -> "") in
let value_parser = take_till is_space_eol <|> (end_of_input >>| fun _ -> "") in
let p =
lift3
(fun key _sep value -> Directive (key, value))
Expand Down
13 changes: 13 additions & 0 deletions test/test_markdown.ml
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,23 @@ let inline =
:END:\r\n"
(Property_Drawer
[ ("now", "1614485729874"); ("done", "1614485743195") ]) )
; ( "front-matter-endwith-space"
, `Quick
, check_aux
"---\r\n\
now: 1614485729874 \n\
done: 1614485743195 \n\
---\r\n"
(Property_Drawer
[ ("now", "1614485729874"); ("done", "1614485743195") ]) )
; ( "simplified-property-syntax"
, `Quick
, check_aux "a.b.c:: def\na-b-c::"
(Property_Drawer [ ("a.b.c", "def"); ("a-b-c", "") ]) )
; ( "simplified-endwith-space"
, `Quick
, check_aux "a.b.c:: def \na-b-c::"
(Property_Drawer [ ("a.b.c", "def"); ("a-b-c", "") ]) )
; ( "empty-property"
, `Quick
, check_aux ":PROPERTIES:\r\n:END:\r\n" (Property_Drawer []) )
Expand Down