Communitygithub.com

mdlive

Turn Markdown into a branded, interactive HTML page with one command — one self-contained .html that opens from disk offline on any machine (to send or attach), or a live page served on this machine and reloaded on every save (to show on a screen). Dark by default with a switch to light, the colours, logo and faces of an mdbrand brand bundle, sortable and searchable tables and {{data…}} values from YAML/JSON/CSV files, the dark palette derived to WCAG contrast. Sibling of mdbrand (which makes the PDF from the same source). Use INSTEAD of hand-writing HTML, CSS or JavaScript pages, calling Quarto or pandoc for HTML, or linking libraries from a CDN. Load when asked for a web page, HTML report, página, informe web, interactive or live document, a page to show on a screen or send as one file, or the screen version of a document mdbrand builds as a PDF.

What is mdlive?

mdlive is a Claude Code agent skill that turn Markdown into a branded, interactive HTML page with one command — one self-contained .html that opens from disk offline on any machine (to send or attach), or a live page served on this machine and reloaded on every save (to show on a screen). Dark by default with a switch to light, the colours, logo and faces of an mdbrand brand bundle, sortable and searchable tables and {{data…}} values from YAML/JSON/CSV files, the dark palette derived to WCAG contrast. Sibling of mdbrand (which makes the PDF from the same source). Use INSTEAD of hand-writing HTML, CSS or JavaScript pages, calling Quarto or pandoc for HTML, or linking libraries from a CDN. Load when asked for a web page, HTML report, página, informe web, interactive or live document, a page to show on a screen or send as one file, or the screen version of a document mdbrand builds as a PDF.

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/carlosprados/mdlive/tree/HEAD

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Preview

From the skill README

Ventas mensuales
Distribución de latencias
Despliegue en planta

Documentation

mdlive — a branded page from Markdown

Never hand-write the HTML, a Quarto project or a <script src> to a CDN: an AI-written page fails in silence (a library missing offline, a chart with no data, a Spanish number printed 30,000, words that do not read on their ground). mdlive takes those decisions once, and a page that would reach its reader broken stops the build, naming the fix.

PDF, Word, slides → mdbrand. A page for a screen → mdlive. One source can build both: mdbrand: {brand: x} in the front matter is read by both tools.

Commands

mdlive build report.md                  # report.html beside it: one file, offline
mdlive build report.md -o out/page.html
mdlive build report.md --brand none     # no brand bundle
mdlive serve report.md --browser vivaldi  # live: rebuilt and reloaded on save
mdlive doctor                           # what is missing and how to install it

Exit status 0 is a page written; anything else is an error on stderr, with the fix named. mdlive <cmd> --help is the full manual.

The source

Plain Markdown with an optional front matter:

---
title: Informe de facturación
subtitle: Octubre 2026
author: Carlos Prados
lang: es
mdbrand: {brand: amplia}   # or mdlive: {brand: amplia}; mdlive's wins
---

## Resumen

Texto, listas, tablas Markdown, imágenes relativas al fichero, código.
  • lang sets the page's language (hyphenation, and number and date formats on charts). Set it: es for Spanish.
  • toc: true, toc-depth, and number-sections: true (or mdbrand's numbersections: true) at the top level. Keys inside mdbrand: other than brand (style, reference, confidential…) are mdbrand's and ignored.
  • date: an ISO date (2026-11-29) is printed in lang ("29 de noviembre de 2026"); free text ("29 de noviembre de 2026 (rev. 3)") is printed as written.
  • : Caption under a table captions it; ::: {.keep} and other mdbrand page controls are accepted and do nothing on a page.
  • Pictures are found beside the source; keep them in the source's folder.
  • The brand's logo goes above the title, in both themes: an SVG keeps its colours where they read on dark and has the others lightened; a PNG or JPG sits on a light plate in the dark theme.
  • The brand: --brand > front matter > ~/.config/mdlive/config.yaml (brand:), else mdbrand's configuration. Bundles are mdbrand's own, found in --brands-dir, MDLIVE_BRANDS_DIR, mdlive's or mdbrand's brands_dir.

Running serve from an agent

serve never exits on its own. Run it in the background, without opening a browser on the user's desktop unless asked, and read the URL from its output:

mdlive serve report.md --no-open        # prints the http://127.0.0.1:PORT/ URL

It listens on localhost only. --listen 0.0.0.0:PORT exposes it to the network: only when the user asks for that.

The browser check

Every build and every serve rebuild opens the finished page in headless Chrome, in the dark theme and the light one, at 390 px (a phone) and 1280 px, and stops on:

FindingWhat to do
a block that drew nothing, or axes with no marks; a table that did not become sortable (mdlive's defect: report it)the chart's data has rows, and the fields it plots are columns of it
text under 4.5:1 (3:1 if large) on its grounda colour written in raw HTML: take it out; if it names code or mdlive, report it
the page wider than the screena width written in raw HTML: take it out; a long URL: shorten it or put it in a code block
a request off the page (https://…)download the file beside the source and link it
an error or exception in the browser consolethe chart spec it names, or raw <script>: take it out
a face that failed to loadmdlive doctor, or clear ~/.cache/mdlive/fonts

Each finding names the theme, the heading it is under and a sample of the text. Never work round one by changing the check: fix the page. Without Chrome the build warns that the page was not checked; install it.

Tables scroll sideways in their own box on a phone, and so does a chart wider than the screen; the page itself never does.

Tables and data

Every table on the page sorts by any column (click a header: ascending, descending, back to the source's order), and one of more than ten rows gets a search box. Numbers sort as numbers in the page's lang (1.234,5 in Spanish); a last row whose first cell is bold (**Total**) stays last, and is hidden while a search is on. Nothing to write for it.

Data comes from files, with mdbrand's syntax, so one source makes both the PDF and the page. Files in data/ beside the source (YAML, JSON, CSV, TSV), or the roots in mdlive: {data: …} (else mdbrand: {data: …}):

La flota tiene {{data.flota[GW-05].nodos}} nodos en su pasarela mayor.

```table
source: flota                 # data/flota.yaml; or rows: [id, id] to pick and order
where: {region: Norte}        # equality only
columns: {id: Pasarela, nodos: Nodos, consumo: {label: Consumo, unit: W, decimals: 1}}
sort: -nodos                  # one field; - descends
total: [nodos, consumo]       # an exact Total row
caption: Pasarelas por nodos
```

![Ventas mensuales](data/ventas.csv)
  • Never type a table whose rows are in a data file; never copy a number from one into prose: {{data.file.key}}, {{data.file[id].field}}.
  • A link to a data file alone on its line is the whole file as a table.
  • A key, id or column that is not there stops the build listing the real ones.
  • A chart reads the same rows with "data": {"name": "flota"}.

Charts: Vega-Lite

Interactive charts (tooltips, zoom, a selection in one view filtering another), drawn in the reader's browser from libraries inside the page. The syntax is mdbrand's, so the same source makes the PDF figure:

```vegalite caption="Ventas mensuales por región"
{
  "data": {"url": "data/ventas.csv"},
  "mark": {"type": "line", "point": true},
  "encoding": {
    "x": {"field": "mes", "type": "temporal", "title": "Mes"},
    "y": {"field": "importe", "type": "quantitative", "title": "Importe"},
    "color": {"field": "region", "type": "nominal"},
    "tooltip": [{"field": "region"}, {"field": "importe"}]
  },
  "params": [{"name": "zoom", "select": "interval", "bind": "scales"}]
}
```

![Distribución de latencias](charts/latencia.vl.json)
  • Fences: vegalite, vega-lite, vega, vl; caption="…". Side files: .vl.json, .vl.yaml, linked as a picture.
  • Data is inlined at build time. data.url is a local CSV, TSV or JSON, relative to the source (a fence) or to the spec file (a link). Separator , ; or tab is detected; with ;, 1250,5 reads as a number. A BOM is stripped. These stop the build, naming the chart and its heading: a remote URL (download it into data/), a missing file, Latin-1 (save as CSV UTF-8), a row with a different number of fields, a file with no rows.
  • Every field the chart plots must be a column of its data: a typo stops the build with the nearest column ("did you mean"), unless a transform makes the field. A plotted column mixing numbers and text (12, n/d) stops too, since Vega would drop the text in silence.
  • Leave width out of a single view: it fills the column. Composed views (vconcat, hconcat, facet, repeat, layer) need a width per child.
  • Interactivity is Vega-Lite's own: tooltip in encoding; zoom and pan with "params": [{"name": "z", "select": "interval", "bind": "scales"}]; a brush that filters another view with {"name": "brush", "select": "interval"} plus "transform": [{"filter": {"param": "brush"}}] in the other.
  • Every chart answers the pointer: bars, lines, areas and points show the fields of their encoding without a tooltip; lines and areas get transparent points so every value is a target. Write tooltip to choose the fields or their format. A rect mark (a heatmap) needs its own "tooltip": true: rect is left out because a selection brush is one.
  • Numbers and dates in the page's lang: 1.250,5, febrero, 1 ene 2026 for es; tables for es, ca, de, fr, it, nl, da, pt, and numbers for gl and eu. A chart with dates in a language with no month names (gl, eu…) stops the build: write the axis labels yourself (labelExpr, or a nominal field).
  • The brand fills what the spec leaves unset: series colours (figures.palette, else primary and link, then hues turned from the primary, each held to 3:1 on the theme's ground and 30° apart), axis and label colours, the body face, 12–13 px labels, a transparent ground. Any config or color in the spec wins. Each chart is drawn again in the other theme's colours when the reader switches.

Diagrams: D2

Architecture, flows, sequences and state, rendered at build time into the page, once per theme. Same syntax as mdbrand:

```d2 caption="Flujo de una orden"
direction: down
api: API { auth: Autenticación; pedidos: Pedidos }
cola: Cola {shape: queue}
api.pedidos -> cola: publica
```

![Despliegue en planta](diagrams/planta.d2)
  • Needs d2 on the PATH (mdlive doctor). @import resolves against the source's folder (a fence) or the .d2's own (a link).
  • The brand colours it in both themes: shapes in tints of the primary, words and strokes in the text colour, every fill held to 4.5:1 under its words. Setting theme-id or theme-overrides in the .d2 turns that off.
  • Sizing is the tool's. A diagram shows at d2's own size, shrunk to the 800 px column when wider. If that would take its labels under 11 px the build stops with the fixes in order: direction: down for a sideways one, layout-engine: elk, fewer or shorter labels, split it. Do not set font sizes to get round it.

Diagrams: Mermaid

Every Mermaid type (flowchart, sequence, state, class, ER, gantt, pie…), drawn at build time in headless Chrome, once per theme, in the brand's colours and body face. The page carries the SVG, not Mermaid.

```mermaid caption="Ciclo de un aviso"
flowchart TD
  s[Sensor] --> g[Gateway] -->|MQTT| p[Plataforma]
```
  • Needs Chrome or Chromium on the PATH (mdlive doctor).
  • A diagram that does not parse stops the build with Mermaid's own message and the block's heading.
  • Wider than the 800 px column with labels under 11 px once shrunk stops the build: flowchart TD instead of LR, shorter labels, or split it.
  • For architecture with containers, prefer D2; Mermaid for sequences, states, gantt and quick flows.

Still being built: KPI cards, 3D plots. Until a block exists, do not paste raw HTML or <script> into the source to get one: it bypasses the brand, the dark theme and the offline guarantee. Say it is not available yet, or build the PDF with mdbrand, which already draws D2.

Install

mdlive skill install          # this file into ~/.claude/skills/mdlive/
mdlive skill install --force  # after upgrading the binary

Related Skills