makeup_lmml

MakeupLmml

CI Hex.pm Documentation License

A Makeup lexer for LMML (Language Model Markup Language) narratives and Markdown.

LMML is a strict superset of Markdown designed for structuring LLM conversations and multimodal payloads: any standard Markdown text is already valid LMML. This library provides syntax highlighting for both LMML constructs and full CommonMark formatting in ExDoc and any other tool using Makeup.

Key Features

Installation

Add makeup_lmml to your list of dependencies in mix.exs:

def deps do
  [
    {:makeup_lmml, "~> 0.1"}
  ]
end

The lexer automatically registers with Makeup on application start for:

Usage

In ExDoc

Once added to your project, ExDoc will automatically highlight code blocks tagged with lmml, markdown, or md:

```lmml
# Project Context

Please review @diagram.png before the meeting.

@@@settings.yaml
model: gpt-5
temperature: 0.2
@@@
```

Direct Usage

alias Makeup.Lexers.LmmlLexer

# Tokenize an LMML document:
tokens = LmmlLexer.lex("""
# Project Context

Please review @diagram.png before the meeting.

@@@settings.yaml
model: gpt-5
temperature: 0.2
@@@
""")

# Render HTML using Makeup:
html = Makeup.highlight(doc, lexer: LmmlLexer)

Token Mapping

Construct Token Type CSS Class
Embed fence (@@@), Code fence (```) :string_delimiter dl
Embed name (settings.yaml), External ref (@a.png) :name_entity ni
Code block language hint (elixir) :name_class nc
Level-1 heading (# Heading, ===) :generic_heading gh
Level 2–6 heading (## Heading, ---) :generic_subheading gu
Bold text (**bold**, __bold__) :generic_strong gs
Italic text (*italic*, _italic_) :generic_emph ge
Strikethrough (~~deleted~~) :generic_deleted gd
Inline code (code) :string_backtick sb
Embed / code block body (fallback) :string s
Link text, Image alt, HTML tag :name_tag nt
Link URL, Image destination, HTML attribute :name_attribute na
Reference link identifier ([id]:) :name_label nl
List markers (-, *, 1.), blockquotes (>) :keyword k
HTML comments (<!-- ... -->) :comment_multiline cm
Escaped characters (\*, \@) :string_escape se
Delimiters, brackets, table pipes :punctuation p
Prose and unclassified text :text (unstyled)
Whitespace and line breaks :whitespace w

License

MIT — see LICENSE for details.