Library
Module
Module type
Parameter
Class
Class type
Mdx
is a library to manipulate markdown code blocks.
mdx
allows to execute code blocks inside markdow files. The supported code blocks are either cram-like tests, raw OCaml fragments or toplevel phrases.
Cram tests and toplevel phrases are sequences of commands and outputs.
module Output : sig ... end
Test outputs.
module Cram : sig ... end
Cram tests
module Toplevel : sig ... end
Toplevel phrases.
module Block : sig ... end
Code blocks.
The type for the lines of a markdown file.
type t = line list
The type for mdx documents.
val to_string : t -> string
to_string t
converts the document t
to a string.
val of_string : string -> t
of_string s
is the document t
such that to_string t = s
.
val parse_lexbuf : Lexing.lexbuf -> t
parse_lexbuf l
is of_string
of l
's contents.
val run : f:(string -> t -> string) -> string -> unit
run ~f n
runs the expect callback f
over the file named n
. f
is called with the raw contents of n
and its structured contents; it returns the new file contents. If the result of f
is different from the initial contents, then $n.corrected
is created with the new contents.
val section_of_line : line -> (int * string) option
section_of_line l
is l
's section.