Update omd to 2.0.0~alpha3
This commit is contained in:
parent
02dbe1af37
commit
92fb616980
2 changed files with 10 additions and 10 deletions
16
lib/utils.ml
16
lib/utils.ml
|
@ -74,19 +74,19 @@ module Omd = struct
|
||||||
Some (Omd.Definition_list (attr, def_elts))
|
Some (Omd.Definition_list (attr, def_elts))
|
||||||
| Omd.Code_block _
|
| Omd.Code_block _
|
||||||
| Omd.Thematic_break _ as v -> Some v
|
| Omd.Thematic_break _ as v -> Some v
|
||||||
| Omd.Table (attr, inline_alignments, inlines) ->
|
| Omd.Table (attr, header_row, rows) ->
|
||||||
let inline_alignments =
|
let header_row =
|
||||||
List.fold_left (fun acc (cell, alignment) ->
|
List.fold_left (fun acc (cell, alignment) ->
|
||||||
match acc with
|
match acc with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some xs ->
|
| Some xs ->
|
||||||
Option.map (fun cell -> xs @ [ cell, alignment ])
|
Option.map (fun cell -> xs @ [ cell, alignment ])
|
||||||
(safe_inline cell))
|
(safe_inline cell))
|
||||||
(Some []) inline_alignments
|
(Some []) header_row
|
||||||
in
|
in
|
||||||
Option.map
|
Option.map
|
||||||
(fun inline_alignments ->
|
(fun header_row ->
|
||||||
let inlines =
|
let rows =
|
||||||
List.filter_map (fun row ->
|
List.filter_map (fun row ->
|
||||||
List.fold_left (fun acc cell ->
|
List.fold_left (fun acc cell ->
|
||||||
match acc with
|
match acc with
|
||||||
|
@ -94,10 +94,10 @@ module Omd = struct
|
||||||
| Some xs -> Option.map (fun cell -> xs @ [ cell ])
|
| Some xs -> Option.map (fun cell -> xs @ [ cell ])
|
||||||
(safe_inline cell))
|
(safe_inline cell))
|
||||||
(Some []) row)
|
(Some []) row)
|
||||||
inlines
|
rows
|
||||||
in
|
in
|
||||||
Omd.Table (attr, inline_alignments, inlines))
|
Omd.Table (attr, header_row, rows))
|
||||||
inline_alignments
|
header_row
|
||||||
and safe_def_elts { term ; defs } =
|
and safe_def_elts { term ; defs } =
|
||||||
let defs = List.filter_map safe_inline defs in
|
let defs = List.filter_map safe_inline defs in
|
||||||
safe_inline term
|
safe_inline term
|
||||||
|
|
|
@ -3,12 +3,12 @@ let markdown_to_html = Builder_web__Utils.Omd.html_of_string
|
||||||
let test_simple () =
|
let test_simple () =
|
||||||
let markdown = {|# Hello world|} in
|
let markdown = {|# Hello world|} in
|
||||||
let html = markdown_to_html markdown in
|
let html = markdown_to_html markdown in
|
||||||
Alcotest.(check string "simple html" "<h1>Hello world</h1>\n" html)
|
Alcotest.(check string "simple html" "<h1 id=\"hello-world\">Hello world</h1>\n" html)
|
||||||
|
|
||||||
let test_html_script () =
|
let test_html_script () =
|
||||||
let markdown = {|# <script>Hello world</script>|} in
|
let markdown = {|# <script>Hello world</script>|} in
|
||||||
let html = markdown_to_html markdown in
|
let html = markdown_to_html markdown in
|
||||||
Alcotest.(check string "html script header" "<h1>Hello world</h1>\n" html)
|
Alcotest.(check string "html script header" "<h1 id=\"hello-world\">Hello world</h1>\n" html)
|
||||||
|
|
||||||
let test_preserve_span_content () =
|
let test_preserve_span_content () =
|
||||||
let markdown = {|* <span id="myref">My ref</span>
|
let markdown = {|* <span id="myref">My ref</span>
|
||||||
|
|
Loading…
Reference in a new issue