m2-market/solutions/mm-pdf-report/payload/SKILL.md

89 lines
3.2 KiB
Markdown

---
name: mm-pdf
description: Generate beautifully styled Machine.Machine branded PDFs and slide decks from Markdown. Dark navy aesthetic, cyan accents, professional A4 layout. Uses a headless-Chrome render container (any container with Node + Chrome, e.g. a "*-m2o" agent-desktop image) or a local WeasyPrint fallback. Produces PDF + HTML output.
---
# mm-pdf
Generate MM-branded documents from Markdown content.
## Design system
| Token | Value | Use |
|-------|-------|-----|
| Cover background | `#0a0e1a` | Dark navy |
| Primary accent | `#4bb8d4` | Cyan — headings, kickers, borders |
| Section banners | `#3d4550` | Slate grey |
| Purple sidebar | `#6b46c1` | Alt cover variant |
| Body text | `#e2e8f0` | Light grey on dark bg |
| Body background | `#111827` | Dark page bg |
| Code/data blocks | `#1e2533` | Slightly lighter navy |
## Usage
```bash
# Generate PDF from markdown
mm-pdf generate input.md [--out output.pdf] [--style dark|purple|light]
# Generate slide deck (Marp)
mm-pdf slides input.md [--out output.pdf]
# With explicit container (auto-discovery picks the first "*m2o*" container if omitted)
mm-pdf generate input.md --container <your-render-container-name>
```
## Pipeline
1. **MD → HTML** — a small Node script (via `marked`) renders Markdown into full MM-styled
HTML. Extracts YAML frontmatter (`title`, `subtitle`, `date`, `client`) for the cover
page. Strips the first `# H1` to use as title if no frontmatter is present.
2. **HTML → PDF** — Chrome headless renders the HTML to PDF (`--print-to-pdf`).
Both outputs are saved alongside the input file.
## Output
- `<name>.html` — standalone styled HTML (preview, shareable)
- `<name>.pdf` — print-ready PDF
## Styles
| Style | Cover | Use case |
|-------|-------|----------|
| `dark` | Navy `#0a0e1a` + cyan accent | Technical specs, deployment docs |
| `purple` | Purple sidebar `#6b46c1` | Partner decks |
| `light` | White + navy header | Client-facing docs |
`dark.css` and `purple.css` ship in `templates/`. `light` is documented for forward
compatibility but has no template in this bundle yet — add `templates/light.css` locally
if you need it (it will be picked up automatically; `generate.sh` falls back to `dark.css`
for any missing style file).
## Components (in Markdown)
```markdown
<!-- KPI card row -->
<div class="kpi-row">
<div class="kpi">**€5K** setup</div>
<div class="kpi">**€2K**/mo</div>
<div class="kpi">**8 weeks** pilot</div>
</div>
<!-- Section kicker -->
<span class="kicker">DEPLOYMENT ARCHITECTURE</span>
<!-- Warning/callout -->
<div class="callout">⚠️ Open item: integration path TBD</div>
```
## Requirements
- Docker, with a running container that has Node.js + Google Chrome (headless) installed
and reachable via `docker exec`/`docker cp` from the host running this skill. Any
container name is fine — `scripts/generate.sh` auto-discovers the first container whose
name matches `nasr-m2o|m2o`, or accepts `--container <name>` to target any other
container that meets the Node+Chrome requirement.
- `docker` CLI available on the host invoking `mm-pdf`.
No absolute host paths, hostnames, or client-identifying data are baked into this skill —
`--container` and the input Markdown path are the only machine-specific inputs at run time.