{it, ...}: let md = import ../nixite/md.nix; elems = import ../nixite/elems.nix; in with md; [ (it "matches a list of one element" { actual = list '' - something ''; expected = { matched = true; block = elems.List ["something"]; }; asJSON = true; }) (it "makes a list of many elements" { actual = list '' - something - something else ''; expected = { matched = true; block = elems.List ["something" "something else"]; }; asJSON = true; }) (it "makes a list of many checkboxes" { actual = list '' - [ ] something - [X] something else ''; expected = { matched = true; block = elems.List [ [ (elems.input { type = "checkbox"; disabled = true; checked = false; } "") "something" ] [ (elems.input { type = "checkbox"; disabled = true; checked = true; } "") "something else" ] ]; }; asJSON = true; }) (it "matches a list with no whitespace around" { actual = list '' - something - something else''; expected = { matched = true; block = elems.List ["something" "something else"]; }; asJSON = true; }) (it "doesnt match not a list" (let str = "blah blah"; in { actual = list str; expected = { matched = false; block = str; }; })) (it "processes whole string with all rules" { actual = processStr '' this text **may** *or may not* contain **bold** words *inside* it. ''; expected = elems.p [ "this text" (elems.strong "may") (elems.em "or may not") "contain" (elems.strong "bold") "words" (elems.em "inside") "it." ]; asString = true; }) (it "makes paragraphs" { actual = readMd '' lorem ipsum dolor sit foo bar ''; expected = ''

lorem ipsum dolor sit

foo bar

''; asString = true; }) (it "can fix file appendixes" { actual = fixAppendix "index.md"; expected = "index.html"; }) (it "converts markdown to a page" { actual = toString (mdToPage ./blog/index.md) + "\n\n"; # inflation expected = builtins.readFile ./out/index.html; asString = true; }) (it "recursively reads dir" { actual = recReadMd ./blog; expected = { "index.md" = mdToPage ./blog/index.md; "dir" = {"index.md" = mdToPage ./blog/dir/index.md;}; }; asJSON = true; }) (it "recursively fixes filename" { actual = recFixAppendix { "index.md" = "something"; dir = {"index.md" = "something else";}; }; expected = { "index.html" = "something"; dir = {"index.html" = "something else";}; }; }) (it "recursively translates md to html" { actual = builtins.toJSON (readDir ./blog); expected = builtins.toJSON { "index.html" = mdToPage ./blog/index.md; "dir" = {"index.html" = mdToPage ./blog/dir/index.md;}; }; }) ]