Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Mehari
SourceThis module provides the core abstraction, it does not depend on any platform code, and does not interact with the environment.
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
.
paragraph to_gemtext str
is a convenient function to transform a string containing line breaks (CR
or CRLF
) into a Gemtext document.
open Mehari.Gemtext
assert (Mehari.paragraph quote "hello\nworld" = [ quote "hello"; quote "world" ])
User client certificates.
Creates a new response
with given Mehari.status
.
A wrapper around Gemini status codes.
code_of_status s
is status code associated with status s
.
Mehari offers ways to keep client connections open forever and stream data in real time such as seq
and stream
functions when the flush
parameter is specified. It is important to note that most Gemini clients do not support streaming and should be used with caution. That's why this parameter is set to false
by default in all the functions that Mehari expose.
Creates a body
from given lines. Each line is written followed by a newline (LF
) character.
page ~title content
creates a simple Gemtext body
of form:
# title
content
Creates a body
from a string sequence. See A note on data stream response for a description of flush
parameter.
stream (fun consume -> ...)
creates a body
from a data stream. Each call to consume
write the given input on socket. Useful for stream data or file chunk in real time. See A note on data stream response for a description of flush
parameter.
make_mime ?charset mime
creates a mime
type from given charset
. Charset defaults to utf-8
if mime type begins with text/
.
from_filename ?charset fname
tries to create a mime
by performing a mime lookup based on file extension of fname
.
Note that mime gemini
are not infered from files with .gmi
extension. See https://github.com/Psi-Prod/Mehari/issues/36.
from_content ?charset c
tries to create a mime
type by performing a mime lookup based on content c
.
gemini ?charset ?lang ()
is text/gemini; charset=...; lang=...
.