package mehari

  1. Overview
  2. Docs

Implementation of the Gemini own native response format. Note that if a string containing line breaks (CR or CRLF) is given to functions heading, list_item and quote only the first line will be formatted and the others treated as normal text. To avoid this behavior, see Mehari.paragraph.

open Mehari.Gemtext

assert ([ quote "hello\nworld" ] = [ quote "hello"; text "world" ])
type t = line list
and line =
  1. | Text of string
  2. | Preformat of preformat
  3. | Heading of [ `H1 | `H2 | `H3 ] * string
  4. | ListItem of string
  5. | Quote of string
and preformat = {
  1. alt : string option;
  2. text : string;
}
val of_string : string -> t
val to_string : t -> string

Facilities

val text : string -> line
val newline : line

newline is text "".

val preformat : ?alt:string -> string -> line
val heading : [ `H1 | `H2 | `H3 ] -> string -> line
val list_item : string -> line
val quote : string -> line
val pp : Stdlib.Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.