1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
include Ast.Impl
module Ctor = Ast_constructors.Impl
let = Toc.headers
let toc = Toc.toc
let parse_inline defs s = Parser.inline defs (Parser.P.of_string s)
let parse_inlines (md, defs) : doc =
let defs =
let f (def : attributes Parser.link_def) =
{ def with label = Parser.normalize def.label }
in
List.map f defs
in
List.map (Ast_block.Mapper.map (parse_inline defs)) md
let escape_html_entities = Html.htmlentities
let of_channel ic : doc = parse_inlines (Block_parser.Pre.of_channel ic)
let of_string s = parse_inlines (Block_parser.Pre.of_string s)
let to_html ?auto_identifiers doc =
Html.to_string (Html.of_doc ?auto_identifiers doc)
let to_sexp ast = Format.asprintf "@[%a@]@." Sexp.print (Sexp.create ast)