HTML Style Guide

html-style-guide Convention

active convention pal-e-docs

HTML Style Guide

How to author html_content for pal-e-docs notes. Notes are HTML fragments rendered inside a Jinja2 template shell (base.html) with shared CSS. This guide ensures consistent, readable output across all agents and humans.

Allowed Elements

Element Use for Notes
<code>&lt;h2&gt;</code> Note title / major sections Styled at 1.25rem inside <code>.note-content</code>. Use as the top-level heading in note content.
<code>&lt;h3&gt;</code> Subsections Used for template section matching. Templates validate by checking <code>&lt;h3&gt;</code> headings.
<code>&lt;h4&gt;</code> Sub-subsections Use sparingly — within phases of plans or subsections of large notes.
<code>&lt;p&gt;</code> Prose paragraphs Styled with 0.5rem vertical margin.
<code>&lt;ul&gt;</code>, <code>&lt;ol&gt;</code> Lists Indented with 1.5rem left margin.
<code>&lt;li&gt;</code> List items 0.25rem vertical margin.
<code>&lt;table&gt;</code> Structured data, comparisons, matrices Use <code>&lt;th&gt;</code> for header cells.
<code>&lt;code&gt;</code> Inline code, slugs, commands, variable names Light gray background (#f0f0f0), 3px border-radius, 0.9em font-size.
<code>&lt;pre&gt;&lt;code&gt;</code> Code blocks For multi-line code snippets.
<code>&lt;pre class="mermaid"&gt;</code> Mermaid diagrams Auto-rendered by mermaid.js. See <code>mermaid-authoring</code> convention.
<code>&lt;strong&gt;</code> Bold emphasis For key terms, labels in lists.
<code>&lt;em&gt;</code> Italic emphasis For asides, clarifications.
<code>&lt;a href="..."&gt;</code> External links Blue (#0366d6), underline on hover. For internal note references, use inline <code>&lt;code&gt;slug&lt;/code&gt;</code> instead.

Structure Patterns

Standard note structure

Decision table

Roadmap / checklist

CSS Classes Available in base.html

These classes are defined in base.html and available in the browse frontend:
Class Purpose Use in notes?
<code>.badge</code> Status/platform badge base Rarely — in project page repo tables
<code>.badge-github</code> Dark badge for GitHub In repo tables
<code>.badge-forgejo</code> Green badge for Forgejo In repo tables
<code>.badge-active</code> Green badge for active status In repo tables
<code>.badge-archived</code> Gray badge for archived In repo tables
<code>pre.mermaid</code> Mermaid diagram block Yes — see <code>mermaid-authoring</code>
Other classes (.tag, .meta, .section, .card-grid, .card, .doc-list) are used by Jinja2 templates, not by note content directly.

What NOT to Do

  • Don't use inline style="" attributes — all styling comes from base.html
  • Don't use <div> for layout — stick to semantic HTML
  • Don't use <h1> — the page template provides the h1 from the note title
  • Don't use <img> — no image hosting; use mermaid for diagrams
  • Don't use <script> — security risk, especially when notes go public
  • Don't add CSS classes that don't exist in base.html — they'll be silently ignored

XSS Note

Note content is rendered with | safe in Jinja2 — no sanitization. Fine for internal use (trusted agents/humans). HTML sanitization must be added before notes go public via Tailscale Funnel.
  • mermaid-authoring — mermaid diagram convention
  • note-conventions — slug naming, tagging, and linking conventions