Page
Library
Module
Module type
Parameter
Class
Class type
Source
MehariSourceThis module provides the core abstraction, it does not depend on any platform code, and does not interact with the environment.
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
let () = assert (Mehari.paragraph quote "hello\nworld" = [ quote "hello"; quote "world" ])User client certificates. [] if client provides none.
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
contentCreates 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 ~tree c tries to create a mime type by performing a mime lookup based on content c. tree is the tree used to build the MIME database.
gemini ?charset ?lang () is text/gemini; charset=...; lang=....