Implementation and test for horizontal rule

master
Aadhavan Srinivasan 1 month ago
parent 0320402957
commit 1d9ac86a2a

@ -407,9 +407,13 @@ parseOrderedList = do
void (char '\n') <++ eof
return $ OrdList (firstLine : lineItems)
parseHorizontalRule :: ReadP MdToken
parseHorizontalRule = string "---" *> (void (string "\n\n") <++ eof) *> return HorizontalRule
documentParsers :: [ReadP MdToken]
documentParsers =
[ parseHeader,
[ parseHorizontalRule,
parseHeader,
parseBlockquote,
parseUnorderedList,
parseOrderedList,

@ -110,6 +110,10 @@ figureTests =
[ check_equal "Image by itself" "<figure><img src=\"img.png\" alt=\"Image 1\"/><figcaption aria-hidden=\"true\">Image 1</figcaption></figure>" (convert "![Image 1](img.png)")
]
horizontalRuleTests =
TestList
[check_equal "Horizontal Rule" "<p>a</p><hr><p>b</p>" (convert "a\n\n---\n\nb")]
integrationTests =
TestList
[ check_equal "Integration 1" "<h1>Sample Markdown</h1><p>This is some basic, sample markdown.</p><h2><b>Second</b> <i>Heading</i></h2>" (convert "# Sample Markdown\n\n This is some basic, sample markdown.\n\n ## __Second__ _Heading_"),
@ -147,6 +151,7 @@ tests =
imageTests,
figureTests,
codeTests,
horizontalRuleTests,
integrationTests
]

Loading…
Cancel
Save