struct
include Metadoc
let to_markdown_string ?(line_width=72) sm =
to_string ~line_width ~indent:4 sm
let new_par = n % n
let h underliner t =
let title = to_markdown_string t in
let l = String.length title in
let underline = String.make l underliner in
verbatim title % n % verbatim underline % new_par
let h1 t = h '=' t
let h2 t = h '-' t
let par t = t % new_par
let emph t = s "*" % t % s "*"
let ul_filter l =
concat (List.filter l ~f:(fun t -> t <> empty)
|> List.map ~f:(fun t -> s "- " % t % n))
% n
let ul_inner l =
indent (separate n (List.map l ~f:(fun t -> s "- " % t)))
let url u = s "<" % verbatim u % s ">"
let link t ~url = brakets t % parens (s url)
end