# a-templates (adapter system)

Templating capability pack: render an inline template ({{path}}, {{#each}}, {{#if}}), build a minimal HTML card, or turn an array of objects into a Markdown table. Reuses a tiny dependency-free...


Templating **capability pack**. Ported from `leumas-middleware/lib/a.templates` — the 3 core adapters.
Stripped: express `server.js`/`router.js`, `public/`, `scripts/`, `docs/`.

The tiny template engine (`{{path}}`, `{{#each}}`, `{{#if}}`) is ESM-ported to
[`./helpers/template.js`](./helpers/template.js) (source was CommonJS `require`/`module.exports`). The
three adapters are folded into `index.js`.

## Tools (`adapters`)

| tool | args | result |
|------|------|--------|
| `render-template` | `{ template, data?, contentType? }` | `{ contentType, output, length }` |
| `html-card` | `{ title, subtitle?, items? }` | `{ contentType: 'text/html', output, length }` |
| `markdown-table` | `{ rows: [{...}, ...] }` | `{ contentType: 'text/markdown', output, length }` |

`render-template` auto-detects `text/html` vs `text/plain` from the template unless `contentType` is
given. `markdown-table` unions keys across rows for the header and escapes `|`.


---
Source: shared/engines/adapters/domain/a-templates/README.md
Canonical: https://docs.leumas.tech/p/adapters/domain/a-templates
