Djot.FrontmatterYAML metadata at the start of a text, between two lines of ---:
--- title: A note tags: [a, b] ---
Frontmatter is not djot. It is read here, before the djot parser, and only where a function is given ~frontmatter:true; the parser then gets the text after it. Such a function raises Invalid_argument when this library was built without the yaml package.
A text starts with frontmatter when all of these hold:
---, with nothing after it but spaces and tabs;--- in the same way, the first such line being the end;Otherwise the text is djot from its first line, where --- is a thematic break. A blank line between two --- lines is not a mapping, so that is two thematic breaks.
type value = [ | `Null| `Bool of bool| `Float of float| `String of string| `A of value list| `O of (string * value) list ]A YAML value, as far as JSON has one. This is the type Yaml.value of the yaml package, so a value can be given to that package's functions as it is.
type t = private {fields : (string * value) list;The mapping, in source order; empty when there is no line between the delimiters.
*)text : string;The lines between the delimiters, as written.
*)loc : Textloc.t;From the opening --- to the closing one. Set whether or not the parse records positions; Textloc.none when made by make or of_string.
}fields is always what text reads as.
The frontmatter with these fields. Its text is the YAML the yaml package writes for them, and no line for no field.
val of_string : string -> t optionThe frontmatter with this text between its delimiters. A newline is added when the text does not end with one. None when the text is not a YAML mapping, or has a --- line, which would end the frontmatter.