# lmml v0.1.0 - Table of Contents

> A Markdown-superset markup language for structuring LLM conversations, with a self-contained text form (.lmml) and a zip-archive form (.lmmlz) for carrying referenced files alongside the narrative.

## Pages

- [Lmml](readme.md)
- [LMML Language Reference](language_reference.md)

## Modules

- [Lmml](Lmml.md): `lmml` is a markup format for talking to LLMs, designed as a strict
superset of Markdown.
- [Lmml.Bundle](Lmml.Bundle.md): A loaded `lmml` entity, regardless of which of the two on-disk forms it
came from
- [Lmml.Document](Lmml.Document.md): A parsed `lmml` narrative: the `Md`-produced AST plus the flat list of
`Lmml.Embed`s discovered anywhere within it (however deeply nested --
inside a list item, a blockquote, an emphasis span, and so on).
- [Lmml.Embed](Lmml.Embed.md): The one abstraction behind both `lmml` embedding syntaxes.
- [Lmml.Manifest](Lmml.Manifest.md): Optional `manifest.json` metadata for a `Lmml.Bundle`.
- [Lmml.Narrative.Parser](Lmml.Narrative.Parser.md): 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.

- [Lmml.Narrative.Reference](Lmml.Narrative.Reference.md): `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).

- [Lmml.Narrative.Renderer](Lmml.Narrative.Renderer.md): 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).
- [Lmml.Narrative.Resolver](Lmml.Narrative.Resolver.md): 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`).
- [Lmml.Narrative.Syntax](Lmml.Narrative.Syntax.md): 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.
- [Lmml.Pack](Lmml.Pack.md): 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

- [mix lmml.inline](Mix.Tasks.Lmml.Inline.md): 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.
- [mix lmml.new](Mix.Tasks.Lmml.New.md): Creates a new, empty `.lmml` narrative file.
- [mix lmml.pack](Mix.Tasks.Lmml.Pack.md): Externalizes every inline embed in a bundle into a real zip entry (see
`Lmml.Pack.pack/2`), writing the result to a `.lmmlz` archive.
- [mix lmml.validate](Mix.Tasks.Lmml.Validate.md): Cross-checks a bundle's narrative against its own entries and internal
consistency (see `Lmml.Bundle.validate/1`), printing every issue found.

