An Idiomd dialect adrmd specmd termd uxmd
termd.dev

Docs / Renderers

Renderers

Renderers implement the kernel's Renderer contract and are freely replaceable — the two below ship as the reference pair.

termd-renderer-html — the default

Emits an alphabetical keyword register followed by one article per term:

  • <nav class="term-register"> — every term plus every synonym, locale-sorted, grouped by first letter. Synonyms point back at their main term ("Post → Article"); retired terms (deprecated/rejected) are marked with class="retired".
  • <article class="term" id="term-{id}"> — the status badge (term-status-{status}), the Definition, the optional sections, and Examples split into do/don't lists by the +/ prefix.
  • Related/ReplacedBy ids become in-page anchor links (#term-{id}); dangling references are reported as warnings.

The markup is unstyled by design — bring your stylesheet, or start from the one this site uses on the examples page.

termd-renderer-json — the AI surface

A flat glossary index, kind structures resolved, empty fields normalized to []/null:

{
  "dialect": "termd",
  "terms": [
    {
      "id": "draft",
      "term": "Draft",
      "status": "approved",
      "definition": "An article that has not been published yet…",
      "scope": null,
      "usage": ["Say \"draft\", not \"unpublished article\"…"],
      "examples": {
        "positive": ["\"You have 3 drafts.\""],
        "negative": ["\"You have 3 unpublished articles.\""]
      },
      "synonyms": [],
      "related": ["article", "writer"],
      "replacedBy": [],
      "sources": []
    }
  ]
}

Use it directly as model context, as a search index, or as the data source for tooltips. Same input, same output — the renderer is roundtrip-stable.

Using a renderer

import { createEngine } from '@idiomd/core';
import { termd } from '@idiomd/dialect-termd';
import { termdJsonRenderer } from 'termd-renderer-json';

const html = createEngine().use(termd)
  .render(doc, { format: 'html' });   // default renderer

const json = createEngine().use(termd, { renderer: termdJsonRenderer })
  .render(doc, { format: 'json' });   // swapped renderer

CSS-framework variants (-tailwind, -bootstrap) follow the family's renderer gallery convention and will ship later.