diff --git a/builder-web.opam b/builder-web.opam index 5dfd9a0..c7c4273 100644 --- a/builder-web.opam +++ b/builder-web.opam @@ -45,7 +45,7 @@ depends: [ "cmdliner" {>= "1.1.0"} "uri" "fmt" {>= "0.8.7"} - "omd" + "omd" {>= "2.0.0~alpha3"} "tar" "owee" "solo5-elftool" {>= "0.3.0"} diff --git a/lib/utils.ml b/lib/utils.ml index c3bd6d2..57cc779 100644 --- a/lib/utils.ml +++ b/lib/utils.ml @@ -74,6 +74,30 @@ module Omd = struct Some (Omd.Definition_list (attr, def_elts)) | Omd.Code_block _ | Omd.Thematic_break _ as v -> Some v + | Omd.Table (attr, header_row, rows) -> + let header_row = + List.fold_left (fun acc (cell, alignment) -> + match acc with + | None -> None + | Some xs -> + Option.map (fun cell -> xs @ [ cell, alignment ]) + (safe_inline cell)) + (Some []) header_row + in + Option.map + (fun header_row -> + let rows = + List.filter_map (fun row -> + List.fold_left (fun acc cell -> + match acc with + | None -> None + | Some xs -> Option.map (fun cell -> xs @ [ cell ]) + (safe_inline cell)) + (Some []) row) + rows + in + Omd.Table (attr, header_row, rows)) + header_row and safe_def_elts { term ; defs } = let defs = List.filter_map safe_inline defs in safe_inline term diff --git a/test/markdown_to_html.ml b/test/markdown_to_html.ml index 4ad62ce..e9c3b17 100644 --- a/test/markdown_to_html.ml +++ b/test/markdown_to_html.ml @@ -3,12 +3,12 @@ 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" "