let markdown_to_html = Builder_web__Utils.Omd.html_of_string let test_simple () = let markdown = {|# Hello world|} in let html = markdown_to_html markdown in Alcotest.(check string "simple html" "
foo
\n" html) let test_absolute_image () = let markdown = "![alttext](https://foo.com/bar.jpg)" in let html = markdown_to_html markdown in Alcotest.(check string "absolute image" "\n" html) let test_absolute_image_no_alt () = let markdown = "![](https://foo.com/bar.jpg)" in let html = markdown_to_html markdown in Alcotest.(check string "absolute image" "\n" html) let test_relative_image () = let markdown = "![](/bar.jpg)" in let html = markdown_to_html markdown in Alcotest.(check string "relative image" "" html) let test_absolute_image_script_alt () = let markdown = "![](https://foo.com/bar.jpg)" in let html = markdown_to_html markdown in Alcotest.(check string "absolute image with script alt text" "\n" html) let test_fragment_link () = let markdown = "[fragment](#fragment)" in let html = markdown_to_html markdown in Alcotest.(check string "fragment link" "fragment
\n" html) let markdown_tests = [ Alcotest.test_case "Simple" `Quick test_simple; Alcotest.test_case "script header" `Quick test_html_script; Alcotest.test_case "preserve span content" `Quick test_preserve_span_content; Alcotest.test_case "Remove script" `Quick test_remove_script; Alcotest.test_case "List with html block and markdown" `Quick test_list_with_html_block_and_markdown; Alcotest.test_case "List with inline html and markdown" `Quick test_list_with_inline_html_and_markdown; Alcotest.test_case "absolute link" `Quick test_absolute_link; Alcotest.test_case "relative link" `Quick test_relative_link; Alcotest.test_case "absolute image" `Quick test_absolute_image; Alcotest.test_case "absolute image no alt" `Quick test_absolute_image_no_alt; Alcotest.test_case "relative image" `Quick test_relative_image; Alcotest.test_case "absolute image with script alt" `Quick test_absolute_image_script_alt; Alcotest.test_case "fragment link" `Quick test_fragment_link; ] let () = Alcotest.run "Markdown to HTML" [ "markdown", markdown_tests ]