diff --git a/lib/utils.ml b/lib/utils.ml index bb4fa3f..57cc779 100644 --- a/lib/utils.ml +++ b/lib/utils.ml @@ -74,19 +74,19 @@ module Omd = struct Some (Omd.Definition_list (attr, def_elts)) | Omd.Code_block _ | Omd.Thematic_break _ as v -> Some v - | Omd.Table (attr, inline_alignments, inlines) -> - let inline_alignments = + | 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 []) inline_alignments + (Some []) header_row in Option.map - (fun inline_alignments -> - let inlines = + (fun header_row -> + let rows = List.filter_map (fun row -> List.fold_left (fun acc cell -> match acc with @@ -94,10 +94,10 @@ module Omd = struct | Some xs -> Option.map (fun cell -> xs @ [ cell ]) (safe_inline cell)) (Some []) row) - inlines + rows in - Omd.Table (attr, inline_alignments, inlines)) - inline_alignments + 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" "