package omd

  1. Overview
  2. Docs
A Markdown frontend in pure OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

omd-2.0.0.alpha1.tbz
sha256=5800b920db48d68fa77d8270d64a45989eac398f76d733267827c9a0b2a90390
sha512=0c545a52a706a47fd9fe233f3daf7d4d4907ddd32b6faa9bb75df9086995f44ea341ed9b30d334c393d4f340c7f3bc27e99a0f8cb70943c7d4bd30128ed51fef

doc/src/omd/omd.ml.html

Source file omd.ml

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
module Pre = Block.Pre

include Ast

type doc = block list

let parse_inline defs s =
  Parser.inline defs (Parser.P.of_string s)

let parse_inlines (md, defs) =
  let defs =
    let f (def : link_def) = {def with label = Parser.normalize def.label} in
    List.map f defs
  in
  List.map (Mapper.map (parse_inline defs)) md

let of_channel ic =
  parse_inlines (Pre.of_channel ic)

let of_string s =
  parse_inlines (Pre.of_string s)

let to_html doc =
  Html.to_string (Html.of_doc doc)

let to_sexp ast =
  Format.asprintf "@[%a@]@." Sexp.print (Sexp.create ast)
OCaml

Innovation. Community. Security.