API Reference Lmml v#0.1.0

View Source

Modules

lmml is a markup format for talking to LLMs, designed as a strict superset of Markdown.

A loaded lmml entity, regardless of which of the two on-disk forms it came from

A parsed lmml narrative: the Md-produced AST plus the flat list of Lmml.Embeds discovered anywhere within it (however deeply nested -- inside a list item, a blockquote, an emphasis span, and so on).

The one abstraction behind both lmml embedding syntaxes.

Optional manifest.json metadata for a Lmml.Bundle.

The lmml narrative parser: everything Md.Parser.Syntax's Default syntax module supports (headings, lists, emphasis, links, tables, standard fenced code, ...) plus @name.ext external references and @@@name.ext ... @@@ inline embeds. See Lmml.Narrative.Syntax for exactly what's added/overridden.

Md.Transforms implementation for the @name.ext external-reference magnet: turns a bare @name.ext mention into an :lmml_ref AST node carrying the raw referenced name, without assuming anything about what kind of file it points to (image, settings, arbitrary attachment).

Turns a Lmml.Narrative.Resolver.t() into the list of typed content parts a multimodal LLM chat completion API expects for a message's content field -- the same %{"type" => ...} shape already built by hand elsewhere in this workspace for vision models (see dsh's DeepSeekHarness.CLI.ContextExpander/Brain.Session, which construct %{"type" => "image_url", "image_url" => %{"url" => data_uri}} and %{"type" => "text", "text" => text} parts).

Resolves every embed a bundle's narrative mentions against the bundle itself, producing a fully-resolved intermediate structure that pairs each Lmml.Embed with its actual bytes -- trivially for an inline embed (its bytes are already its own content) and by zip-entry lookup for an external reference (Lmml.Bundle.embed/2).

Builds the Md syntax map used by Lmml.Narrative.Parser: Md.Parser.Syntax's Default syntax module's prose/structure categories, plus lmml's own additions/overrides.

Converts between lmml's two on-disk forms by moving each embed between being carried inline in the narrative text (@@@name ... @@@) and being carried as a real zip entry (@name) -- the mechanical operation the .lmml <-> .lmmlz conversion boils down to, per the "Embed is the one abstraction" design decision (see docs/LANGUAGE_REFERENCE.md).

Mix Tasks

Inlines every external reference in a bundle into a @@@name ... @@@ block (see Lmml.Pack.inline/2), writing the result to a bare .lmml text file.

Creates a new, empty .lmml narrative file.

Externalizes every inline embed in a bundle into a real zip entry (see Lmml.Pack.pack/2), writing the result to a .lmmlz archive.

Cross-checks a bundle's narrative against its own entries and internal consistency (see Lmml.Bundle.validate/1), printing every issue found.