package bracetax

  1. Overview
  2. Docs

Module for handling links.

type kind = [
  1. | `local
  2. | `generic
]
type t = {
  1. kind : kind;
  2. linkto : string option;
  3. other_args : string list;
  4. contents : Buffer.t;
}
val get_kind : string -> [> `generic | `local ] * string

In the returned string, if it is a "local:" link, removes the "local:" part.

val create : ?kind:kind -> ?linkto:string -> ?other_args:string list -> unit -> t
val start : ?url_hook:(string -> string) -> string list -> [> `link of t ] * (string -> unit)

Start recording a link, it returns the Stack.environment element to put in the stack, and new "output" function to write/record the text of the link.

val stop : t -> kind * string option * string option

Stop recoring a link, returns the kind of link, the optional target, and the optional link text (already transformed).

val unparse : [< `generic | `local ] -> string option -> string option -> string

Transform back to a Bracetax string (treats the text as pure text).