2023-12-31 00:24:48 +00:00
|
|
|
let
|
|
|
|
md = import ../nixite/md.nix;
|
|
|
|
elems = import ../nixite/elems.nix;
|
|
|
|
it = import ./it.nix;
|
|
|
|
in
|
|
|
|
with md; [
|
|
|
|
(assert heading "# heading 1" == ["#" "heading 1"]; "gets heading 1")
|
|
|
|
(assert heading "## subheading" == ["##" "subheading"]; "gets heading 2")
|
|
|
|
(assert heading "some paragraph" == null; "paragraph is heading 0")
|
|
|
|
|
|
|
|
(assert mdBlock "# heading 1" == elems.h 1 "heading 1"; "makes h1 tag")
|
|
|
|
(assert mdBlock "## subheading" == elems.h 2 "subheading"; "makes h2 tag")
|
2023-12-31 04:27:09 +00:00
|
|
|
(assert mdBlock "some paragraph" == elems.p {} "some paragraph"; "makes p tag")
|
2023-12-31 00:24:48 +00:00
|
|
|
|
|
|
|
(it "processes md block" {
|
|
|
|
actual = readMd ''
|
|
|
|
# foo bar
|
|
|
|
|
|
|
|
lorem ipsum
|
|
|
|
'';
|
|
|
|
expected = [
|
|
|
|
(elems.h 1 "foo bar")
|
|
|
|
""
|
2023-12-31 04:27:09 +00:00
|
|
|
(elems.p {} "lorem ipsum\n")
|
2023-12-31 00:24:48 +00:00
|
|
|
];
|
|
|
|
})
|
|
|
|
]
|