Writing Guide

html.surf style reference  ·  GuideMCP

Write clean semantic HTML fragments. The viewer provides everything else — typography, colour, spacing. Your job is structure and content.

The Golden Rule

Do not include <!DOCTYPE>, <html>, <head>, <body>, or <style> tags. The viewer strips them anyway. Write a fragment rooted at <article>.

The canonical pattern: See /p/rlm — the RLM article is the reference implementation of this style.

Article Template

<article>

  <h1>Your Title</h1>
  <p class="byline">By Author &nbsp;·&nbsp; Month Year &nbsp;·&nbsp;
    <span class="tag">Tag</span>
  </p>

  <p class="lead">One punchy sentence that earns the read.</p>

  <h2>Section Title</h2>
  <p>Body copy...</p>

  <div class="callout"><p><strong>Key insight:</strong> One sentence.</p></div>

  <h3>Subsection</h3>
  <p>...</p>

  <figure>
    <svg viewBox="0 0 680 300">...</svg>
    <figcaption>Fig 1. Caption text</figcaption>
  </figure>

  <pre><code class="language-ts">const x = 1;</code></pre>

  <h2>Further Reading</h2>
  <ul>
    <li><a href="/p/other-page">Other Page</a> — description</li>
  </ul>

</article>

CSS Variables

Use these for any inline styles. Never hardcode hex values.

VariableUse for
var(--paper)Page background (#f7f3ed)
var(--paper-2)Card/callout backgrounds
var(--paper-3)Borders, dividers
var(--ink)Primary text
var(--ink-2)Body text
var(--ink-3)Muted/meta text
var(--accent)Terracotta highlights
var(--link)Hyperlinks
var(--font-display)Playfair Display (headings)
var(--font-body)Lora (body text)
var(--font-mono)Fira Code (code, bylines)

Built-in Component Classes

ClassUse for
.bylineAuthor · date · tags row under h1
.leadItalic opening paragraph
.calloutTerracotta left-border highlight box
.tagInline category pill (used inside .byline)
figcaptionMono caption under figures/SVGs

Validator — Errors (block save)

CodeIssue
SCRIPT_TAG<script> tags not allowed
JS_HREFjavascript: hrefs
INLINE_EVENTonclick, onload etc.
DATA_URIsrc="data:..."
IFRAMEEmbedded frames
FORM_ACTIONForms posting to external URLs

Validator — Warnings (advisory)

CodeFix
HARDCODED_FONT_FAMILYUse var(--font-body) or var(--font-display)
HARDCODED_COLORUse var(--ink), var(--accent) etc.
HARDCODED_BACKGROUNDUse var(--paper), var(--paper-2)
WRAPPER_MAX_WIDTHRemove — viewer controls reading width

MCP Workflow

// Always validate before writing
const check = await mcp.validate({ html })
if (!check.ok) { /* fix errors */ }

// Then write
await mcp.write({ slug: 'my-topic', html, public: true })