owflow 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: diagrams-mermaid
3
+ description: Generate Mermaid diagrams from natural language descriptions. Creates diagrams in markdown format with mermaid code fences. Supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, user journeys, Gantt charts, pie charts, and C4 diagrams.
4
+ argument-hint: [diagram description]
5
+ generated-from-skill: true
6
+ ---
7
+
8
+ CRITICAL INSTRUCTION: You MUST invoke the diagrams-mermaid skill immediately as your FIRST action.
9
+
10
+ Use the Skill tool with these exact parameters:
11
+ name: "diagrams-mermaid"
12
+ prompt: "$ARGUMENTS"
13
+
14
+ DO NOT:
15
+
16
+ - Analyze the task before invoking the skill
17
+ - Decide the task is "straightforward" and skip the skill
18
+ - Substitute your own approach or workflow
19
+ - Execute any part of the workflow yourself
20
+
21
+ WHY: The user explicitly chose this workflow by using /diagrams-mermaid.
22
+ Invoke the skill now and let it orchestrate the complete workflow.
23
+
24
+ ---
25
+
26
+ ## About This Skill
27
+
28
+ Generate Mermaid diagrams from natural language descriptions. Creates diagrams in markdown format with mermaid code fences. Supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, user journeys, Gantt charts, pie charts, and C4 diagrams.
29
+
30
+ The skill handles:
31
+
32
+ - Diagram type selection based on description
33
+ - Mermaid syntax generation with proper formatting
34
+ - Best practices and anti-patterns enforcement
35
+ - Output in markdown format with mermaid code fences
36
+
37
+ See `skills/diagrams-mermaid/SKILL.md` for complete documentation.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: html-renderer
3
+ description: Render a markdown plan, idea, RFC, or design note into a self-contained, share-ready HTML file using the warm editorial visual system. Output is a single .html file with all CSS inlined, written next to the source markdown file.
4
+ argument-hint: [path to markdown file]
5
+ generated-from-skill: true
6
+ ---
7
+
8
+ CRITICAL INSTRUCTION: You MUST invoke the html-renderer skill immediately as your FIRST action.
9
+
10
+ Use the Skill tool with these exact parameters:
11
+ name: "html-renderer"
12
+ prompt: "$ARGUMENTS"
13
+
14
+ DO NOT:
15
+
16
+ - Analyze the task before invoking the skill
17
+ - Decide the task is "straightforward" and skip the skill
18
+ - Substitute your own approach or workflow
19
+ - Execute any part of the workflow yourself
20
+
21
+ WHY: The user explicitly chose this workflow by using /html-renderer.
22
+ Invoke the skill now and let it orchestrate the complete workflow.
23
+
24
+ ---
25
+
26
+ ## About This Skill
27
+
28
+ Render a markdown plan, idea, RFC, or design note into a self-contained, share-ready HTML file using the warm editorial visual system. Output is a single .html file with all CSS inlined, written next to the source markdown file.
29
+
30
+ The skill handles:
31
+
32
+ - Markdown parsing and semantic HTML generation
33
+ - Design system application with warm editorial styling
34
+ - Mermaid diagram rendering via CDN (when present)
35
+ - Self-contained output with inlined CSS
36
+
37
+ See `skills/html-renderer/SKILL.md` for complete documentation.
@@ -235,6 +235,15 @@ question - "UI mockups complete. Continue to Phase 5?"
235
235
 
236
236
  **SELF-CHECK**: Did you just invoke the Task tool with `specification-creator`? Or did you start writing spec.md yourself? If the latter, STOP immediately and invoke the Task tool instead.
237
237
 
238
+ **Part D — Diagram Refinement (Skill, content-preserving)**:
239
+
240
+ 7. Invoke Skill tool: `diagrams-mermaid` to refine `implementation/spec.md`
241
+ 8. Add diagrams that clarify scope and communication (without replacing prose):
242
+ - `flowchart` for primary functional path,
243
+ - `sequenceDiagram` for key component interaction,
244
+ - optionally `C4Component` if internal module structure is required by scope.
245
+ 9. If required context is missing, add explicit open questions/assumptions section instead of inventing entities.
246
+
238
247
  **Output**: `analysis/technical-clarifications.md` (conditional), `analysis/requirements.md`, `implementation/spec.md`
239
248
  **State**: Update `task_context.tech_clarified`, `task_context.architecture_decision`, `phase_summaries.specification`
240
249
 
@@ -285,6 +294,12 @@ question - Display executive summary before asking. Read `verification/spec-audi
285
294
 
286
295
  **SELF-CHECK**: Did you just invoke the Task tool with `implementation-planner`? Or did you start writing implementation-plan.md yourself? If the latter, STOP immediately and invoke the Task tool instead.
287
296
 
297
+ **Post-plan diagram refinement (Skill, content-preserving)**:
298
+
299
+ - Invoke Skill tool: `diagrams-mermaid` for `implementation/implementation-plan.md`
300
+ - Add a compact execution diagram (task-group dependency flow or phase/state view).
301
+ - Keep implementation steps authoritative; diagrams are explanatory, not a replacement for task descriptions.
302
+
288
303
  → Pause
289
304
 
290
305
  question - Display executive summary before asking. Read `implementation/implementation-plan.md` and extract: number of task groups, total implementation steps, key dependencies between groups, estimated complexity. Format as brief overview then "Continue to implementation?"
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: diagrams-mermaid
3
+ description: Creates Mermaid diagrams for planning flows, component communication, and architecture views with adaptive detail selection (including C4 levels). This skill should be used when the user asks for a workflow, interaction, or architecture visualization from provided task context.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Mermaid Diagram Builder
8
+
9
+ Generate Mermaid diagrams from task context. Focus on visual structure and communication flow, not domain invention.
10
+
11
+ ## 🚨 Core Rules
12
+
13
+ 1. **Read `references/reference.md`** (located in the `references/` subdirectory of this skill) before generating any diagram.
14
+ 2. **Refine, don't replace** — use the current document or task artifact as source material; add visual precision on top of it and keep required narrative sections intact.
15
+ 3. **Never invent domain context** — if required facts are missing (actors, components, boundaries, protocols, decisions), ask targeted clarification questions before drawing the final diagram.
16
+ 4. **Output diagrams only as fenced `mermaid` blocks** (non-negotiable):
17
+ - ✅ Allowed: ` ```mermaid `
18
+ - ❌ Forbidden: ` ```c4plantuml `, ` ```plantuml `, ` ```puml `, ` ```graphviz `, ` ```dot `, ` ```d2 `, or any custom alias.
19
+ - This rule cannot be overridden by user preference, template defaults, or legacy examples.
20
+
21
+ ---
22
+
23
+ ## When to Use
24
+
25
+ Use this skill when the user wants:
26
+
27
+ - a planning flow diagram,
28
+ - component communication visualization,
29
+ - architecture-level mapping,
30
+ - phase/state transitions in a workflow.
31
+
32
+ ---
33
+
34
+ ## Output Contract
35
+
36
+ When producing a diagram, return:
37
+
38
+ 1. **Diagram Type + Detail Rationale** (1-3 lines)
39
+ 2. **Diagram in a fenced ` ```mermaid ` block (required)**
40
+ 3. **Open Questions** (only if context is incomplete)
41
+
42
+ Validation requirement before returning output:
43
+
44
+ - Every diagram block in the response uses the `mermaid` fence exactly. Any other fence language is a hard failure.
45
+
46
+ If context is incomplete:
47
+
48
+ - ask concise clarifying questions first,
49
+ - or provide a **Draft diagram** clearly marked as provisional with explicit unknowns.
50
+
51
+ ---
52
+
53
+ ## Workflow
54
+
55
+ ### Step 1: Extract Context
56
+
57
+ Extract only explicit facts from user input and referenced artifacts:
58
+
59
+ - scope and objective,
60
+ - participants/components,
61
+ - boundaries (system/service/module),
62
+ - key interactions or state transitions,
63
+ - constraints and non-goals.
64
+
65
+ If any required field is missing for the chosen diagram type, ask for it.
66
+
67
+ ### Step 2: Infer Diagram Goal
68
+
69
+ Classify what the user needs:
70
+
71
+ - **Process logic** -> `flowchart`
72
+ - **Time-ordered communication** -> `sequenceDiagram`
73
+ - **State transitions / phase gates** -> `stateDiagram-v2`
74
+ - **Architecture landscape** -> C4 (`C4Context` / `C4Container` / `C4Component`)
75
+
76
+ ### Step 3: Infer Detail Level
77
+
78
+ Choose the minimum sufficient detail:
79
+
80
+ - **System-level**: external actors/systems only -> `C4Context`
81
+ - **Service/container-level**: apps/services/datastores + interfaces -> `C4Container`
82
+ - **Module/component-level**: internal components in one container -> `C4Component` (only when implementation-level planning needs it)
83
+
84
+ Fallback rule:
85
+
86
+ - If C4 is too ambiguous or unstable for the requested artifact, use `flowchart` or `sequenceDiagram`.
87
+
88
+ ### Step 4: Build Diagram
89
+
90
+ Apply naming and structure rules:
91
+
92
+ - Stable IDs, human-readable labels.
93
+ - One concern per diagram (split large scope into multiple diagrams).
94
+ - For branching logic, use explicit decisions.
95
+ - For interactions, use `alt`, `opt`, `par` where needed.
96
+
97
+ ### Step 5: Validate Quality
98
+
99
+ Run this checklist before final output:
100
+
101
+ - Diagram type matches user intent.
102
+ - Detail level matches planning need (not over/under detailed).
103
+ - No speculative domain entities or links.
104
+ - Labels are clear and consistent.
105
+ - Syntax is parser-safe.
106
+ - All diagram blocks are fenced with ` ```mermaid ` (no alternatives).
107
+
108
+ ---
109
+
110
+ ## Mermaid/C4 Best Practices
111
+
112
+ 1. **Goal-first, syntax-second**: pick the view before drawing nodes.
113
+ 2. **Small readable views**: split diagrams instead of creating one overloaded graph.
114
+ 3. **Consistent naming**: keep IDs stable and semantic.
115
+ 4. **Explicit branching/parallelism**: model alternatives and parallel flows clearly.
116
+ 5. **C4 discipline**: do not mix levels (context/container/component) in one diagram.
117
+ 6. **Parser safety**:
118
+ - quote labels with special characters,
119
+ - avoid reserved or fragile node IDs,
120
+ - avoid custom style/color directives unless explicitly required.
121
+
122
+ ---
123
+
124
+ ## Anti-Examples (What Not To Do)
125
+
126
+ 1. **Invented domain context (critical anti-pattern)**
127
+ Adding components, protocols, or dependencies not present in provided context.
128
+
129
+ 2. **Mixed abstraction levels**
130
+ Combining system landscape and low-level function internals in a single diagram.
131
+
132
+ 3. **Unreadable mega-diagram**
133
+ Packing too many nodes/edges into one chart without decomposition.
134
+
135
+ 4. **Sequence without temporal semantics**
136
+ Using `sequenceDiagram` while omitting real call order, branches, or optional paths.
137
+
138
+ 5. **Placeholder naming**
139
+ IDs and labels like `A`, `B`, `step1` with no domain meaning.
140
+
141
+ 6. **Non-Mermaid diagram fence (hard failure)**
142
+ Returning diagrams in ` ```c4plantuml `, ` ```plantuml `, or any other non-`mermaid` fenced format.
143
+
144
+ When any anti-pattern appears, stop and refactor the output before returning it.
145
+
146
+ ---
147
+
148
+ ## C4 Detail Decision Matrix
149
+
150
+ | Need | Recommended Type | Minimum Inputs |
151
+ | ----------------------------------------------- | ---------------- | ----------------------------------------------- |
152
+ | Who interacts with the system? | `C4Context` | actors, external systems, system boundary |
153
+ | How services/data stores communicate? | `C4Container` | containers, interfaces, protocols/data flow |
154
+ | How one service/module is internally organized? | `C4Component` | container scope, components, internal contracts |
155
+
156
+ If minimum inputs are missing, ask questions instead of guessing.
@@ -0,0 +1,148 @@
1
+ # Mermaid Diagram Reference
2
+
3
+ Quick reference for selecting and writing diagrams in planning workflows.
4
+
5
+ Hard rule for output artifacts:
6
+ - Every diagram must be emitted only in fenced ` ```mermaid ` blocks.
7
+ - Any other fenced diagram format (for example ` ```c4plantuml ` or ` ```plantuml `) is not allowed.
8
+
9
+ ## Quick Type Selector
10
+
11
+ ```mermaid
12
+ flowchart TD
13
+ inputTask[TaskContext] --> needTime{NeedTimeOrder}
14
+ needTime -->|yes| seq[sequenceDiagram]
15
+ needTime -->|no| needState{NeedStateTransitions}
16
+ needState -->|yes| state[stateDiagram-v2]
17
+ needState -->|no| needArch{NeedArchitectureView}
18
+ needArch -->|yes| c4level{RequiredC4Level}
19
+ c4level -->|system| c4context[C4Context]
20
+ c4level -->|service| c4container[C4Container]
21
+ c4level -->|module| c4component[C4Component]
22
+ needArch -->|no| flow[flowchart]
23
+ ```
24
+
25
+ ## Minimal Templates
26
+
27
+ ### flowchart
28
+
29
+ ```mermaid
30
+ flowchart TD
31
+ start[Start] --> decision{"Condition?"}
32
+ decision -->|"yes"| nextA[PathA]
33
+ decision -->|"no"| nextB[PathB]
34
+ nextA --> done[Done]
35
+ nextB --> done
36
+ ```
37
+
38
+ ### sequenceDiagram
39
+
40
+ ```mermaid
41
+ sequenceDiagram
42
+ participant User
43
+ participant ServiceA
44
+ participant ServiceB
45
+ User->>ServiceA: Request
46
+ alt ValidInput
47
+ ServiceA->>ServiceB: FetchData
48
+ ServiceB-->>ServiceA: Data
49
+ ServiceA-->>User: Success
50
+ else InvalidInput
51
+ ServiceA-->>User: ValidationError
52
+ end
53
+ ```
54
+
55
+ ### stateDiagram-v2
56
+
57
+ ```mermaid
58
+ stateDiagram-v2
59
+ [*] --> Draft
60
+ Draft --> Review: submit
61
+ Review --> Approved: accept
62
+ Review --> Draft: request_changes
63
+ Approved --> [*]
64
+ ```
65
+
66
+ ### C4Context
67
+
68
+ ```mermaid
69
+ C4Context
70
+ Person(user, "User")
71
+ System(targetSystem, "TargetSystem")
72
+ System_Ext(extSystem, "ExternalSystem")
73
+ Rel(user, targetSystem, "Uses")
74
+ Rel(targetSystem, extSystem, "Calls")
75
+ ```
76
+
77
+ ### C4Container
78
+
79
+ ```mermaid
80
+ C4Container
81
+ Person(user, "User")
82
+ System_Boundary(boundary, "TargetSystem") {
83
+ Container(webApp, "WebApp", "React", "UI")
84
+ Container(apiService, "APIService", "Node.js", "Business logic")
85
+ ContainerDb(mainDb, "MainDB", "PostgreSQL", "Persistent storage")
86
+ }
87
+ Rel(user, webApp, "Interacts with")
88
+ Rel(webApp, apiService, "Calls")
89
+ Rel(apiService, mainDb, "Reads/Writes")
90
+ ```
91
+
92
+ ## Anti-Patterns
93
+
94
+ 1. **Domain hallucination (critical)**
95
+ Adding systems/components not present in supplied context.
96
+
97
+ 2. **Abstraction mixing**
98
+ Example: C4 context and function-level call chain in one chart.
99
+
100
+ 3. **Unbounded complexity**
101
+ One giant diagram instead of split views.
102
+
103
+ 4. **Ambiguous naming**
104
+ Non-semantic IDs (`A`, `B`, `step1`) without readable labels.
105
+
106
+ 5. **Sequence misuse**
107
+ Interaction diagram without meaningful order/branches.
108
+
109
+ 6. **Non-Mermaid fenced output (hard failure)**
110
+ Emitting any diagram in a non-`mermaid` fenced block.
111
+
112
+ ## "Bad -> Better" Examples
113
+
114
+ ### Inventing missing context
115
+
116
+ Bad:
117
+ - "Assume we also have Kafka and Redis" (not provided by user/context)
118
+
119
+ Better:
120
+ - "Current context is missing messaging/storage components. Please confirm whether any queue/cache exists."
121
+
122
+ ### Mixed detail levels
123
+
124
+ Bad:
125
+ - One diagram contains external systems, services, and method-level internals.
126
+
127
+ Better:
128
+ - Diagram 1: C4 context/container; Diagram 2: sequence for one critical interaction.
129
+
130
+ ## Parser Safety Notes
131
+
132
+ - Use quoted labels for text with special characters.
133
+ - Avoid fragile IDs and reserved keywords.
134
+ - Prefer clear ASCII names for IDs.
135
+ - Keep one diagram focused on one communication concern.
136
+
137
+ ## Integration Candidates
138
+
139
+ Integrated into:
140
+ - `src/skills/flow-init/SKILL.md` - Phase 6 (architecture and tech-stack doc refinement)
141
+ - `src/skills/development/SKILL.md` - Phase 5 (spec refinement), Phase 7 (plan refinement)
142
+ - `src/skills/research/SKILL.md` - Phase 5 (high-level design refinement)
143
+ - `src/skills/performance/SKILL.md` - Phase 3 (spec refinement), Phase 5 (plan refinement)
144
+ - `src/skills/migration/SKILL.md` - Phase 3 (spec refinement), Phase 4 (plan refinement)
145
+
146
+ Reference files:
147
+ - `src/skills/flow-init/references/architecture-template.md`
148
+ - `src/skills/orchestrator-framework/references/orchestrator-patterns.md`
@@ -146,6 +146,21 @@ Fill templates using:
146
146
 
147
147
  Write each file to `.owflow/docs/project/`.
148
148
 
149
+ **Diagram refinement (content-preserving, do NOT replace prose):**
150
+
151
+ - If Architecture doc is selected and `.owflow/docs/project/architecture.md` exists:
152
+ 1. Invoke Skill tool: `diagrams-mermaid`
153
+ 2. Pass context from analysis + generated architecture content
154
+ 3. Add Mermaid sections that **refine** the document:
155
+ - `## Visual Architecture Context` (prefer `C4Context` or `C4Container`)
156
+ - `## Component Communication Flow` (prefer `sequenceDiagram` or `flowchart`)
157
+ 4. Keep existing architecture narrative intact; diagrams must supplement, not replace sections.
158
+
159
+ - If Tech Stack doc is selected and `.owflow/docs/project/tech-stack.md` exists:
160
+ 1. Invoke Skill tool: `diagrams-mermaid`
161
+ 2. Add one lightweight visual section (e.g., runtime/build dependency flow) only if context is sufficient
162
+ 3. If context is insufficient, keep text-only output and list missing details (no invented dependencies).
163
+
149
164
  ---
150
165
 
151
166
  ## PHASE 7: Validate
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: html-renderer
3
+ description: Render a markdown plan, idea, RFC, or design note into a self-contained, share-ready HTML file using the warm editorial visual system bundled under `references/`. Use this skill whenever the user asks to "render", "convert", "turn into HTML", "make a nice HTML version", "share this as a page", or "make this look good" for a markdown file containing a plan, proposal, idea, brief, RFC, design note, or pitch — even if they don't explicitly say "HTML". The output is a single .html file with all CSS inlined, written next to the source .md, that visually matches the reference layout in `references/index.html` and uses tokens from `references/tokens.json`.
4
+ disable-model-invocation: true
5
+ user-invocable: true
6
+ ---
7
+
8
+ # HTML Renderer
9
+
10
+ Turn a markdown plan/idea/RFC into a single self-contained HTML page that follows the warm editorial design system bundled in this skill.
11
+
12
+ ## When to use
13
+
14
+ The user gives you a markdown file (or pastes markdown) describing a plan, idea, proposal, RFC, design note, or brief, and wants a clean HTML representation they can share. Output is *always* a portable single-file `.html` with the stylesheet inlined — no external assets, no JS.
15
+
16
+ This skill is opt-in: it does not auto-trigger. The user invokes it explicitly.
17
+
18
+ ## Inputs and outputs
19
+
20
+ - **Input**: path to a `.md` file (or raw markdown content). If raw markdown is provided, ask for a filename stem.
21
+ - **Output**: write `<source-basename>.html` in the same directory as the source `.md`. If the source is `~/notes/q4-plan.md`, output is `~/notes/q4-plan.html`.
22
+ - **Self-contained**: inline the full stylesheet inside a single `<style>` block in `<head>`. Do not link to external CSS, fonts (use the font stacks already in tokens — they fall back to system fonts), or images that aren't already in the source. The one allowed external script is Mermaid (see "Mermaid diagrams" below), and only when the source contains at least one ` ```mermaid ` fence.
23
+ - **Title**: use the first `# H1` from the markdown as `<title>`; if none, fall back to the file's basename humanized.
24
+
25
+ ## Reference files (read these before writing output)
26
+
27
+ The `references/` folder is the source of truth for the visual system. Read each file once at the start of a rendering task so the output matches:
28
+
29
+ - `references/index.html` — canonical reference page showing every component (heading scale, text block, cards, table, diagram, quote, highlights). Use it as the structural template: the output should look like a variant of this page filled with the user's content.
30
+ - `references/styles.css` — every `hr-*` class definition. **Copy this verbatim into the inlined `<style>` block** of the output. Do not paraphrase, rewrite, or trim it; the classes you emit in the HTML must resolve against these exact rules.
31
+ - `references/tokens.json` — design tokens (colors, spacing, radius, typography). The CSS already consumes these via `:root` variables, so tokens.json is mostly informational — consult it only if the user asks to tweak colors/spacing or when you need to add a new component that should harmonize with existing tokens.
32
+
33
+ Reuse existing classes and tokens before inventing anything. If the user asks for something genuinely new, declare any new CSS variables in `:root` using the same naming pattern, and keep class names prefixed with `hr-`.
34
+
35
+ ## Workflow
36
+
37
+ 1. **Resolve input**: confirm the source markdown path; read the file.
38
+ 2. **Load references**: read `references/index.html` (structure), `references/styles.css` (full CSS to inline), and `references/tokens.json` (only if you need token values).
39
+ 3. **Plan structure**: scan the markdown and decide how to group content into `<section class="hr-section hr-stack">` blocks. Each top-level `##` typically opens a new section.
40
+ 4. **Map elements** using the mapping table below.
41
+ 5. **Assemble** a single HTML document:
42
+ - `<!doctype html>` + `<html lang="en">` + `<head>` with `<meta charset>`, `<meta viewport>`, `<title>`, and a `<style>` block containing the *entire* contents of `references/styles.css`.
43
+ - `<body>` containing `<main class="hr-page">` wrapping the sectioned content.
44
+ 6. **Write** the file as `<basename>.html` next to the source.
45
+ 7. **Verify**: re-open the output and confirm every `class="hr-..."` you emitted exists in the inlined CSS.
46
+
47
+ ## Markdown → HTML mapping
48
+
49
+ | Markdown | HTML |
50
+ |---|---|
51
+ | `# Title` (first one) | `<h1 class="hr-heading-h1">` (also sets `<title>`) |
52
+ | `##`, `###`, `####` | `<h2 class="hr-heading-h2">`, `<h3 class="hr-heading-h3">`, `<h4 class="hr-heading-h4">` |
53
+ | Eyebrow line (italic small intro before H1, e.g. `_Reference Base_`) | `<span class="hr-heading-eyebrow">` |
54
+ | Paragraphs & lists in narrative flow | wrap in `<div class="hr-text-block hr-stack">` |
55
+ | Short summary paragraph right under H1 | `<p class="hr-text-muted">` |
56
+ | Unordered/ordered lists | plain `<ul>`/`<ol>` inside `hr-text-block` |
57
+ | `**bold**` / `*italic*` | `<strong>` / `<em>` |
58
+ | Inline `` `code` `` | `<code>` |
59
+ | Links `[text](url)` | `<a href="url">text</a>` |
60
+ | Horizontal rule `---` | new `<section class="hr-section hr-stack">` (prefer sectioning over `<hr>`) |
61
+ | Tables | `<div class="hr-table-wrap"><table class="hr-table">…</table></div>` |
62
+ | Blockquote `>` | `<blockquote class="hr-quote">`; if the last line starts with `— `, render as `<footer>` |
63
+ | ` ```mermaid ` code fence | `<div class="hr-diagram"><div class="mermaid">…raw mermaid source, **not** HTML-escaped…</div></div>` (also include the Mermaid script described in "Mermaid diagrams" below) |
64
+ | Any other fenced code | `<pre><code>…</code></pre>` (escape `<`, `>`, `&`) |
65
+ | Admonitions — lines starting with `> [!NOTE]`, `> [!WARNING]`, `> [!IMPORTANT]` (GitHub-style) or sections prefixed `**Note:**`, `**Warning:**`, `**Important:**` | `<aside class="hr-highlight hr-highlight-{note\|warning\|important}">` with `<p class="hr-highlight-title">` for the label |
66
+ | Card-like content — a bolded title followed by 1–3 lines, especially in a list of similar items | `<article class="hr-card">` with `<h3 class="hr-card-title">` and `<p class="hr-card-text">`. Wrap multiple cards in `<div class="hr-grid">` (auto-fit). For fixed layouts use `hr-grid-2`, `hr-grid-3`, `hr-grid-4`, `hr-grid-feature` (2fr/1fr/1fr with `hr-card-featured` first), or `hr-grid-sidebar` (2fr/1fr). Mark the most important card as `hr-card-featured`. |
67
+ | Tags / labels (e.g. `[Priority]`, `[Default]`) | `<span class="hr-badge">` |
68
+
69
+ When the markdown is ambiguous (e.g., "is this a card or a paragraph?"), prefer the simpler choice: text block first, cards only when the content is clearly a set of parallel small items.
70
+
71
+ ## Rendering rules
72
+
73
+ 1. Every class you emit must be prefixed `hr-` and must exist in `references/styles.css`. If you need a new one, also add its rule to the inlined `<style>` and (if it relies on a new token) extend `:root`.
74
+ 2. No inline `style="…"` attributes unless the user explicitly asks for a one-off override.
75
+ 3. Favor semantic tags (`section`, `article`, `aside`, `blockquote`, `table`, `figure`) and apply `hr-*` classes on top of them.
76
+ 4. Escape HTML special characters in content (`<`, `>`, `&`) so user prose never breaks the page.
77
+ 5. **Keep the output a single file with zero external dependencies** — it must render correctly when opened directly in a browser. The one exception is the Mermaid CDN script, which is only injected when ` ```mermaid ` fences are present; users will need network access to see those diagrams render (the raw mermaid source remains in the DOM as a graceful fallback).
78
+
79
+ ## Mermaid diagrams
80
+
81
+ When the source markdown contains one or more ` ```mermaid ` fences:
82
+
83
+ 1. Render each fence as:
84
+ ```html
85
+ <div class="hr-diagram">
86
+ <div class="mermaid">
87
+ …raw mermaid source, preserved verbatim, NOT HTML-escaped…
88
+ </div>
89
+ </div>
90
+ ```
91
+ Mermaid replaces the inner text with an SVG at page load, so the content must stay as plain text (do not wrap it in `<pre><code>` and do not escape `<`, `>`, `&` — mermaid needs the original characters).
92
+ 2. Inject the Mermaid script + initializer immediately before `</body>`, exactly once per document:
93
+ ```html
94
+ <script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
95
+ <script>
96
+ window.mermaid &&
97
+ mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
98
+ </script>
99
+ ```
100
+ 3. If the markdown has no ` ```mermaid ` fences, **do not** add the script — keep the output fully offline.
101
+
102
+ ## Minimal example
103
+
104
+ Input (`idea.md`):
105
+ ```markdown
106
+ # Lightweight RFC inbox
107
+
108
+ A small daily ritual to capture half-formed ideas without losing them.
109
+
110
+ ## Why
111
+ Ideas evaporate within a day if there's no easy capture path.
112
+
113
+ ## How
114
+ - One markdown file per idea
115
+ - Rendered to HTML on demand for sharing
116
+
117
+ > [!NOTE]
118
+ > This is intentionally low-tech: no database, no auth.
119
+ ```
120
+
121
+ Output (`idea.html`, abbreviated):
122
+ ```html
123
+ <!doctype html>
124
+ <html lang="en">
125
+ <head>
126
+ <meta charset="UTF-8" />
127
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
128
+ <title>Lightweight RFC inbox</title>
129
+ <style>/* entire contents of references/styles.css inlined here */</style>
130
+ </head>
131
+ <body>
132
+ <main class="hr-page">
133
+ <section class="hr-section hr-stack">
134
+ <h1 class="hr-heading-h1">Lightweight RFC inbox</h1>
135
+ <p class="hr-text-muted">A small daily ritual to capture half-formed ideas without losing them.</p>
136
+ </section>
137
+ <section class="hr-section hr-stack">
138
+ <h2 class="hr-heading-h2">Why</h2>
139
+ <div class="hr-text-block hr-stack">
140
+ <p>Ideas evaporate within a day if there's no easy capture path.</p>
141
+ </div>
142
+ </section>
143
+ <section class="hr-section hr-stack">
144
+ <h2 class="hr-heading-h2">How</h2>
145
+ <div class="hr-text-block hr-stack">
146
+ <ul>
147
+ <li>One markdown file per idea</li>
148
+ <li>Rendered to HTML on demand for sharing</li>
149
+ </ul>
150
+ </div>
151
+ <aside class="hr-highlight hr-highlight-note">
152
+ <p class="hr-highlight-title">Note</p>
153
+ <p>This is intentionally low-tech: no database, no auth.</p>
154
+ </aside>
155
+ </section>
156
+ </main>
157
+ </body>
158
+ </html>
159
+ ```