Module Markdown
type ref
=
{
src : string;
desc : string;
}
type paragraph
=
|
Normal of par_text
|
Pre of string * string option
|
Heading of int * par_text
|
Quote of paragraph list
|
Ulist of paragraph list * paragraph list list
|
Olist of paragraph list * paragraph list list
and par_text
= text list
and text
=
|
Text of string
|
Emph of string
|
Bold of string
|
Struck of par_text
|
Code of string
|
Link of href
|
Anchor of string
|
Image of img_ref
and href
=
{
href_target : string;
href_desc : string;
}
and img_ref
=
{
img_src : string;
img_alt : string;
}
and par_list
= paragraph list
type parse_state
=
{
max : int;
current : Stdlib.Buffer.t;
fragments : text list;
}
val indentation : ?ts:int -> string -> int
val unescape : string -> string
val unescape_slice : string -> first:int -> last:int -> string
val snd_is : string -> char -> bool
val snd_is_space : string -> bool
val collect : ('a -> 'b option) -> 'a -> 'b list
val push_remainder : ?first:int -> int -> string -> (int * string * bool) BatEnum.t -> unit
val adds : Stdlib.Buffer.t -> string -> unit
val addc : Stdlib.Buffer.t -> char -> unit
val new_fragment : unit -> Stdlib.Buffer.t
val push_current : parse_state -> text list
val read_paragraph : ?skip_blank:bool -> int -> (int * string * bool) BatEnum.t -> paragraph option
val skip_blank_line : (int * string * bool) BatEnum.t -> unit
val read_nonempty : int -> (int * string * bool) BatEnum.t -> string -> paragraph option
val read_heading : string -> paragraph option
val read_ul : int -> char -> (int * string * bool) BatEnum.t -> paragraph option
val read_ol : int -> (int * string * bool) BatEnum.t -> paragraph option
val read_list : (paragraph list -> paragraph list list -> paragraph) -> (string -> bool) -> int -> (int * string * bool) BatEnum.t -> paragraph option
val read_pre : string -> (int * string * bool) BatEnum.t -> paragraph option
val read_quote : int -> (int * string * bool) BatEnum.t -> paragraph option
val read_normal : (int * string * bool) BatEnum.t -> paragraph option
val parse_text : string -> par_text
val scan : string -> parse_state -> int -> par_text
val delimited : (first:int -> last:int -> text) -> string -> string -> parse_state -> int -> par_text
val maybe_link : string -> (ref -> text) -> string -> parse_state -> int -> par_text
val scan_past : delim:string -> string -> max:int -> int -> int option
val scan_link : string -> max:int -> int -> (ref * int) option
val matches_at : string -> max:int -> int -> string -> bool
val parse_enum : string BatEnum.t -> paragraph list
val parse_lines : string list -> paragraph list
val parse_text : string -> paragraph list