Components Forms
WYSIWYG Editor
Write and format a draft on the page, then inspect the HTML your form will submit.
Usage
Place the editor inside a form. Set Label to the document name and Name to the field your Go handler reads. Pass the draft HTML in Value, or leave it empty and set Placeholder to a writing prompt.
Register wysiwyg-editor with Head and pass its properties to Render. Go setup guide
Editing a draft
Select a passage to apply bold, italic, or underline. Use Ctrl (or ⌘ on Mac) with B, I, or U for those styles, or K to insert a link. Pasted text takes on the surrounding style. Undo and redo are available in the toolbar.
Place the caret in a paragraph to turn it into a heading, quote, or list. On wide layouts, select a heading in the outline to move the caret there. Open the read-only HTML view to inspect the markup, then use Copy HTML to export it. With JavaScript disabled, the same field appears as a textarea where authors can enter HTML directly.
Submitting a draft
Add a submit button to the surrounding form. The field named by Name carries the HTML in the POST body. To reopen a draft, pass its stored string back as Value. When publishing submitted HTML for readers, sanitize it on the server with an allowlist of elements, attributes, and link schemes before rendering it as markup.
Add a draft to a form
// Inside <form method="post" action="/proof">, before the submit button.
err := mono.UI.Render(w, "wysiwyg-editor", mono.Props{
"Name": "article_body",
"Label": "Pressroom notes",
"Value": "<h2>First proof</h2><p>The ink is still wet.</p>",
"Placeholder": "Start your draft…",
})Read the submitted HTML in Go
// Show the posted markup as plain text so the author can inspect it.
http.HandleFunc("POST /proof", func(w http.ResponseWriter, r *http.Request) {
r.Body = http.MaxBytesReader(w, r.Body, 1<<20)
if err := r.ParseForm(); err != nil {
http.Error(w, "Could not read the draft", http.StatusBadRequest)
return
}
draft := r.PostForm.Get("article_body")
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
io.WriteString(w, draft)
})Go usage
err := mono.UI.Render(w, "wysiwyg-editor", mono.Props{
"Label": "Pressroom notes",
"Name": "article_body",
"Placeholder": "Start your draft…",
"Value": "<h2>The shape of silence</h2><p>The first proof came off the press still warm. I held it up to the window. One line sat too close to the fold, so I moved it the width of my thumb.</p><blockquote>Sometimes the best mark on a page is the space you leave beside it.</blockquote><h3>On the proofing table</h3><p>We kept the rough stock and the heavy ink. On the second proof, the word <em>river</em> had a whole line to itself.</p>",
})Rendered HTML
<section id="demo-wysiwyg-editor" class="mu-writer" data-mono="wysiwyg-editor" data-wysiwyg aria-labelledby="demo-wysiwyg-editor-label">
<header class="mu-writer-head">
<div class="mu-writer-title">
<svg class="mu-writer-mark" viewBox="0 0 40 40" fill="none" aria-hidden="true"><rect x=".5" y=".5" width="39" height="39" rx="9" stroke="currentColor" opacity=".35"/><path d="m9 27 7.6-16h5.1l-7.6 16zm7.2 0 7.6-16h4.9l-7.5 16zm7.1 0 5.8-12.2 2.1 4.5-3.7 7.7z" fill="currentColor"/></svg>
<span id="demo-wysiwyg-editor-label">Pressroom notes</span>
</div>
<div class="mu-writer-modes" role="group" aria-label="Editor view">
<button type="button" data-mode="write" aria-pressed="true" aria-controls="demo-wysiwyg-editor-canvas"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15.5 4.5 4 4M4 20l4.8-1.1L20 7.7a2.8 2.8 0 0 0-4-4L4.9 14.9z"/></svg>Write</button>
<button type="button" data-mode="html" aria-pressed="false" aria-controls="demo-wysiwyg-editor-source"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m7.5 7-5 5 5 5m9-10 5 5-5 5m-3-14-3 18"/></svg>HTML</button>
</div>
</header>
<div class="mu-writer-tools" data-toolbar role="group" aria-label="Text formatting">
<label class="mu-writer-style">
<span class="mu-sr-only">Text style</span>
<select data-block><option value="p">Paragraph</option><option value="h2">Heading</option><option value="h3">Subheading</option></select>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m7 10 5 5 5-5"/></svg>
</label>
<div class="mu-writer-group" role="group" aria-label="Inline formatting">
<button type="button" data-action="bold" aria-label="Bold" aria-pressed="false" title="Bold"><svg viewBox="0 0 24 24" aria-hidden="true"><path stroke-width="2.6" d="M7 4.5h6.2a3.75 3.75 0 0 1 0 7.5H7zm0 7.5h7.3a3.75 3.75 0 0 1 0 7.5H7z"/></svg></button>
<button type="button" data-action="italic" aria-label="Italic" aria-pressed="false" title="Italic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10.5 4.5h8m-13 15h8m1.5-15-6 15"/></svg></button>
<button type="button" data-action="underline" aria-label="Underline" aria-pressed="false" title="Underline"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6.5 3.5v6.8a5.5 5.5 0 0 0 11 0V3.5M4.5 20h15"/></svg></button>
</div>
<div class="mu-writer-group" role="group" aria-label="Lists and quotations">
<button type="button" data-action="ul" aria-label="Bulleted list" aria-pressed="false" title="Bulleted list"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6h11M9 12h11M9 18h11"/><path stroke-width="3" d="M4 6h.1M4 12h.1M4 18h.1"/></svg></button>
<button type="button" data-action="ol" aria-label="Numbered list" aria-pressed="false" title="Numbered list"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10 7h10M10 17h10"/><path stroke-width="1.5" d="m3.5 5.5 1.8-1v5m-1.8 0h3.3M3.4 15a1.8 1.8 0 0 1 3.4.6c0 1.1-1.4 1.9-3.4 3.9H7"/></svg></button>
<button type="button" data-action="quote" aria-label="Block quote" aria-pressed="false" title="Block quote"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h6v6.5c0 2.6-1.6 4-4 4.8m-2-11v6h6m4-6.3h6v6.5c0 2.6-1.6 4-4 4.8m-2-11v6h6"/></svg></button>
</div>
<div class="mu-writer-group" role="group" aria-label="Links and cleanup">
<button type="button" data-action="link" aria-label="Insert or edit link" aria-expanded="false" aria-controls="demo-wysiwyg-editor-link" title="Insert or edit link"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9.5 14.5 5-5m-1.6-3.2 2.3-2.3a3.9 3.9 0 0 1 5.5 5.5l-3.9 3.9a3.9 3.9 0 0 1-5.6 0m-.1 4.3-2.3 2.3a3.9 3.9 0 0 1-5.5-5.5l3.9-3.9a3.9 3.9 0 0 1 5.6 0"/></svg></button>
<button type="button" data-action="clear" aria-label="Clear inline formatting" title="Clear inline formatting"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 5h13m-6.5 0L6 18m-2 .5h4.5M14 14l6 6m0-6-6 6"/></svg></button>
</div>
<div class="mu-writer-group mu-writer-history" role="group" aria-label="Editing history">
<button type="button" data-action="undo" aria-label="Undo" title="Undo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8.5 5.5 4 10l4.5 4.5M4 10h9a6 6 0 0 1 6 6v2"/></svg></button>
<button type="button" data-action="redo" aria-label="Redo" title="Redo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15.5 5.5 4.5 4.5-4.5 4.5M20 10h-9a6 6 0 0 0-6 6v2"/></svg></button>
</div>
</div>
<div class="mu-writer-link" id="demo-wysiwyg-editor-link" data-link-panel role="group" aria-label="Edit link" hidden>
<label for="demo-wysiwyg-editor-url">Link address</label>
<input id="demo-wysiwyg-editor-url" type="text" data-link-url inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://example.com">
<button type="button" data-link-apply>Apply</button>
<button type="button" data-link-cancel>Cancel</button>
</div>
<textarea class="mu-writer-fallback" data-field id="demo-wysiwyg-editor-field" name="article_body" rows="12" aria-labelledby="demo-wysiwyg-editor-label" placeholder="Start your draft…"><h2>The shape of silence</h2><p>The first proof came off the press still warm. I held it up to the window. One line sat too close to the fold, so I moved it the width of my thumb.</p><blockquote>Sometimes the best mark on a page is the space you leave beside it.</blockquote><h3>On the proofing table</h3><p>We kept the rough stock and the heavy ink. On the second proof, the word <em>river</em> had a whole line to itself.</p></textarea>
<div class="mu-writer-compose" id="demo-wysiwyg-editor-canvas" data-compose>
<nav class="mu-writer-outline" data-outline-panel aria-label="Document outline">
<h3><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16M4 12h10M4 19h13"/></svg>Outline</h3>
<div data-outline></div>
</nav>
<div class="mu-writer-desk">
<div class="mu-writer-ruler" aria-hidden="true"></div>
<div class="mu-writer-sheet">
<div class="mu-writer-copy" data-editor role="textbox" aria-multiline="true" aria-labelledby="demo-wysiwyg-editor-label" aria-placeholder="Start your draft…" data-placeholder="Start your draft…" contenteditable="true" spellcheck="true" dir="auto"></div>
</div>
</div>
</div>
<div class="mu-writer-code">
<div class="mu-writer-codehead"><span>HTML source</span>
<button type="button" data-copy-source><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="13" rx="2"/><path d="M15 8V4a1 1 0 0 0-1-1H5a2 2 0 0 0-2 2v10a1 1 0 0 0 1 1h4"/></svg>Copy HTML</button>
</div>
<pre class="mu-writer-source" data-source id="demo-wysiwyg-editor-source" tabindex="0" aria-label="HTML source" hidden></pre>
</div>
<footer class="mu-writer-foot">
<span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h10"/></svg><span data-count>0 words</span></span>
<span class="mu-writer-shortcut"><kbd>Ctrl / ⌘</kbd><kbd>K</kbd>Insert link</span>
</footer>
<p class="mu-writer-message" data-message role="status"></p>
</section>Go template
{{- $label := or .Label "Untitled document" -}}
{{- $placeholder := or .Placeholder "Start writing…" -}}
<section id="{{.ID}}" class="mu-writer" data-mono="wysiwyg-editor" data-wysiwyg aria-labelledby="{{.ID}}-label">
<header class="mu-writer-head">
<div class="mu-writer-title">
<svg class="mu-writer-mark" viewBox="0 0 40 40" fill="none" aria-hidden="true"><rect x=".5" y=".5" width="39" height="39" rx="9" stroke="currentColor" opacity=".35"/><path d="m9 27 7.6-16h5.1l-7.6 16zm7.2 0 7.6-16h4.9l-7.5 16zm7.1 0 5.8-12.2 2.1 4.5-3.7 7.7z" fill="currentColor"/></svg>
<span id="{{.ID}}-label">{{$label}}</span>
</div>
<div class="mu-writer-modes" role="group" aria-label="Editor view">
<button type="button" data-mode="write" aria-pressed="true" aria-controls="{{.ID}}-canvas"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15.5 4.5 4 4M4 20l4.8-1.1L20 7.7a2.8 2.8 0 0 0-4-4L4.9 14.9z"/></svg>Write</button>
<button type="button" data-mode="html" aria-pressed="false" aria-controls="{{.ID}}-source"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m7.5 7-5 5 5 5m9-10 5 5-5 5m-3-14-3 18"/></svg>HTML</button>
</div>
</header>
<div class="mu-writer-tools" data-toolbar role="group" aria-label="Text formatting">
<label class="mu-writer-style">
<span class="mu-sr-only">Text style</span>
<select data-block><option value="p">Paragraph</option><option value="h2">Heading</option><option value="h3">Subheading</option></select>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m7 10 5 5 5-5"/></svg>
</label>
<div class="mu-writer-group" role="group" aria-label="Inline formatting">
<button type="button" data-action="bold" aria-label="Bold" aria-pressed="false" title="Bold"><svg viewBox="0 0 24 24" aria-hidden="true"><path stroke-width="2.6" d="M7 4.5h6.2a3.75 3.75 0 0 1 0 7.5H7zm0 7.5h7.3a3.75 3.75 0 0 1 0 7.5H7z"/></svg></button>
<button type="button" data-action="italic" aria-label="Italic" aria-pressed="false" title="Italic"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10.5 4.5h8m-13 15h8m1.5-15-6 15"/></svg></button>
<button type="button" data-action="underline" aria-label="Underline" aria-pressed="false" title="Underline"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6.5 3.5v6.8a5.5 5.5 0 0 0 11 0V3.5M4.5 20h15"/></svg></button>
</div>
<div class="mu-writer-group" role="group" aria-label="Lists and quotations">
<button type="button" data-action="ul" aria-label="Bulleted list" aria-pressed="false" title="Bulleted list"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6h11M9 12h11M9 18h11"/><path stroke-width="3" d="M4 6h.1M4 12h.1M4 18h.1"/></svg></button>
<button type="button" data-action="ol" aria-label="Numbered list" aria-pressed="false" title="Numbered list"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M10 7h10M10 17h10"/><path stroke-width="1.5" d="m3.5 5.5 1.8-1v5m-1.8 0h3.3M3.4 15a1.8 1.8 0 0 1 3.4.6c0 1.1-1.4 1.9-3.4 3.9H7"/></svg></button>
<button type="button" data-action="quote" aria-label="Block quote" aria-pressed="false" title="Block quote"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h6v6.5c0 2.6-1.6 4-4 4.8m-2-11v6h6m4-6.3h6v6.5c0 2.6-1.6 4-4 4.8m-2-11v6h6"/></svg></button>
</div>
<div class="mu-writer-group" role="group" aria-label="Links and cleanup">
<button type="button" data-action="link" aria-label="Insert or edit link" aria-expanded="false" aria-controls="{{.ID}}-link" title="Insert or edit link"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9.5 14.5 5-5m-1.6-3.2 2.3-2.3a3.9 3.9 0 0 1 5.5 5.5l-3.9 3.9a3.9 3.9 0 0 1-5.6 0m-.1 4.3-2.3 2.3a3.9 3.9 0 0 1-5.5-5.5l3.9-3.9a3.9 3.9 0 0 1 5.6 0"/></svg></button>
<button type="button" data-action="clear" aria-label="Clear inline formatting" title="Clear inline formatting"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 5h13m-6.5 0L6 18m-2 .5h4.5M14 14l6 6m0-6-6 6"/></svg></button>
</div>
<div class="mu-writer-group mu-writer-history" role="group" aria-label="Editing history">
<button type="button" data-action="undo" aria-label="Undo" title="Undo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8.5 5.5 4 10l4.5 4.5M4 10h9a6 6 0 0 1 6 6v2"/></svg></button>
<button type="button" data-action="redo" aria-label="Redo" title="Redo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15.5 5.5 4.5 4.5-4.5 4.5M20 10h-9a6 6 0 0 0-6 6v2"/></svg></button>
</div>
</div>
<div class="mu-writer-link" id="{{.ID}}-link" data-link-panel role="group" aria-label="Edit link" hidden>
<label for="{{.ID}}-url">Link address</label>
<input id="{{.ID}}-url" type="text" data-link-url inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://example.com">
<button type="button" data-link-apply>Apply</button>
<button type="button" data-link-cancel>Cancel</button>
</div>
<textarea class="mu-writer-fallback" data-field id="{{.ID}}-field" name="{{or .Name "content"}}" rows="12" aria-labelledby="{{.ID}}-label" placeholder="{{$placeholder}}">{{.Value}}</textarea>
<div class="mu-writer-compose" id="{{.ID}}-canvas" data-compose>
<nav class="mu-writer-outline" data-outline-panel aria-label="Document outline">
<h3><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16M4 12h10M4 19h13"/></svg>Outline</h3>
<div data-outline></div>
</nav>
<div class="mu-writer-desk">
<div class="mu-writer-ruler" aria-hidden="true"></div>
<div class="mu-writer-sheet">
<div class="mu-writer-copy" data-editor role="textbox" aria-multiline="true" aria-labelledby="{{.ID}}-label" aria-placeholder="{{$placeholder}}" data-placeholder="{{$placeholder}}" contenteditable="true" spellcheck="true" dir="auto"></div>
</div>
</div>
</div>
<div class="mu-writer-code">
<div class="mu-writer-codehead"><span>HTML source</span>
<button type="button" data-copy-source><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="13" rx="2"/><path d="M15 8V4a1 1 0 0 0-1-1H5a2 2 0 0 0-2 2v10a1 1 0 0 0 1 1h4"/></svg>Copy HTML</button>
</div>
<pre class="mu-writer-source" data-source id="{{.ID}}-source" tabindex="0" aria-label="HTML source" hidden></pre>
</div>
<footer class="mu-writer-foot">
<span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h10"/></svg><span data-count>0 words</span></span>
<span class="mu-writer-shortcut"><kbd>Ctrl / ⌘</kbd><kbd>K</kbd>Insert link</span>
</footer>
<p class="mu-writer-message" data-message role="status"></p>
</section>Component CSS
.mu-writer[data-mono] {
--wr-ink: #181818;
--wr-muted: #646464;
--wr-rule: #ccc;
--wr-desk: #e9e9e9;
--wr-side: #f5f5f5;
--wr-sheet: #fff;
--wr-ticks: #aaa;
--wr-wash: #eaeaea;
--wr-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
--wr-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
container-type: inline-size;
width: 100%;
min-width: 0;
color: var(--wr-ink);
background: var(--wr-sheet);
border: 1px solid var(--wr-rule);
border-radius: .85rem;
overflow: clip;
}
[data-theme="dark"] .mu-writer[data-mono] {
--wr-ink: #ededed;
--wr-muted: #b9b9b9;
--wr-rule: #4c4c4c;
--wr-desk: #222;
--wr-side: #262626;
--wr-sheet: #303030;
--wr-ticks: #636363;
--wr-wash: #454545;
color-scheme: dark;
}
.mu-writer-head,
.mu-writer-tools,
.mu-writer-group,
.mu-writer-modes,
.mu-writer-foot,
.mu-writer-title,
.mu-writer-outline h3,
.mu-writer-foot > span {
display: flex;
align-items: center;
}
.mu-writer-head {
justify-content: space-between;
gap: 1.1rem;
padding: .85rem clamp(.85rem, 2.5cqi, 1.75rem);
background: #191919;
color: #fff;
}
.mu-writer-title {
min-width: 0;
gap: .7rem;
font-size: clamp(1.05rem, 2.5cqi, 1.35rem);
font-weight: 610;
line-height: 1.2;
letter-spacing: -.045em;
}
.mu-writer-title span { overflow-wrap: anywhere; }
.mu-writer-mark { flex: none; width: 2.1rem; height: 2.1rem; }
.mu-writer-modes {
flex: none;
padding: 3px;
gap: 2px;
background: #292929;
border: 1px solid #444;
border-radius: 2rem;
}
.mu-writer :where(.mu-writer-modes button, .mu-writer-tools button, .mu-writer-link button) {
display: inline-flex;
align-items: center;
justify-content: center;
border: 0;
border-radius: .32rem;
background: transparent;
color: inherit;
cursor: pointer;
}
.mu-writer-modes button {
gap: .35rem;
min-height: 1.95rem;
padding: .3rem .76rem;
border-radius: 2rem;
color: #d3d3d3;
font-size: .77rem;
font-weight: 600;
}
.mu-writer-modes button:hover { background: #363636; color: white; }
.mu-writer-modes button[aria-pressed="true"] { background: #f6f6f6; color: #171717; }
.mu-writer-head button:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.mu-writer-tools svg, .mu-writer-modes svg, .mu-writer-outline svg, .mu-writer-foot svg {
flex: none;
width: 1.05rem;
height: 1.05rem;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.mu-writer-modes svg { width: .86rem; height: .86rem; }
.mu-writer-tools {
flex-wrap: wrap;
gap: .35rem .65rem;
padding: .55rem clamp(.65rem, 2.5cqi, 1.75rem);
border-bottom: 1px solid var(--wr-rule);
background: var(--wr-sheet);
}
.mu-writer-style { position: relative; display: flex; }
.mu-writer-style select {
appearance: none;
width: 7.65rem;
min-height: 2.1rem;
padding: .3rem 1.7rem .3rem .64rem;
color: var(--wr-ink);
border: 1px solid var(--wr-rule);
border-radius: .35rem;
background: var(--wr-sheet);
font-size: .8rem;
font-weight: 600;
}
.mu-writer-style svg {
position: absolute;
top: 50%;
right: .45rem;
transform: translateY(-50%);
width: .9rem;
height: .9rem;
pointer-events: none;
}
.mu-writer-group { gap: 1px; padding-inline-start: .55rem; border-inline-start: 1px solid var(--wr-rule); }
.mu-writer-tools button { width: 2rem; height: 2.1rem; padding: 0; }
.mu-writer-tools button:hover:enabled, .mu-writer-outline button:hover { background: var(--wr-wash); }
.mu-writer-tools button[aria-pressed="true"] { color: var(--wr-sheet); background: var(--wr-ink); }
.mu-writer-tools button[aria-pressed="true"]:hover { background: var(--wr-ink); }
.mu-writer-history { margin-inline-start: auto; }
.mu-writer-tools button:disabled { opacity: .42; }
.mu-writer-link {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: .5rem;
padding: .65rem clamp(.85rem, 2.5cqi, 1.75rem);
background: var(--wr-side);
border-bottom: 1px solid var(--wr-rule);
font-size: .8rem;
}
.mu-writer-link label { font-weight: 630; }
.mu-writer-link input, .mu-writer-link button {
min-height: 2.05rem;
padding: .32rem .65rem;
border: 1px solid var(--wr-rule);
border-radius: .35rem;
color: var(--wr-ink);
background: var(--wr-sheet);
}
.mu-writer-link input { flex: 1 1 11rem; min-width: 0; max-width: 32rem; }
.mu-writer-link [data-link-apply] { border-color: var(--wr-ink); background: var(--wr-ink); color: var(--wr-sheet); }
.mu-writer-fallback {
display: block;
width: calc(100% - 2rem);
min-width: 0;
margin: 1rem;
padding: 1rem;
background: var(--wr-sheet);
color: var(--wr-ink);
border: 1px solid var(--wr-rule);
border-radius: .3rem;
resize: vertical;
font: .9rem/1.65 var(--wr-mono);
}
.mu-writer:not([data-enhanced]) :is(.mu-writer-modes, .mu-writer-tools, .mu-writer-compose, .mu-writer-foot) { display: none; }
.mu-writer-compose { display: flex; align-items: stretch; }
.mu-writer-outline {
display: block;
flex: 0 0 19%;
max-width: 14rem;
min-width: 0;
padding: 1.7rem clamp(.7rem, 1.6cqi, 1.3rem);
background: var(--wr-side);
border-inline-end: 1px solid var(--wr-rule);
}
.mu-writer-outline h3 {
gap: .55rem;
margin: 0 0 1.2rem;
font: 650 .67rem/1.2 var(--wr-mono);
letter-spacing: .09em;
text-transform: uppercase;
}
.mu-writer-outline svg { width: .96rem; height: .96rem; }
.mu-writer-outline [data-outline] { display: grid; border-inline-start: 1px solid var(--wr-rule); }
.mu-writer-outline button {
min-width: 0;
min-height: 2.05rem;
margin-inline-start: -1px;
padding: .38rem .55rem;
color: var(--wr-ink);
background: transparent;
border: 0;
border-inline-start: 2px solid transparent;
text-align: start;
font-size: .79rem;
font-weight: 590;
line-height: 1.37;
overflow-wrap: anywhere;
}
.mu-writer-outline button[data-level="h3"] { padding-inline-start: 1rem; color: var(--wr-muted); font-weight: 470; }
.mu-writer-outline button:focus-visible { outline-offset: -2px; }
.mu-writer-outline button:where(:hover,:focus-visible,[aria-current="true"]) { border-inline-start-color: var(--wr-ink); }
.mu-writer-desk {
flex: 1 1 0;
min-width: 0;
padding: .8rem clamp(.85rem, 3.6cqi, 3rem) clamp(1.25rem, 3.6cqi, 2.8rem);
background-color: var(--wr-desk);
background-image: radial-gradient(color-mix(in srgb, var(--wr-ticks) 55%, transparent) .65px, transparent .8px);
background-size: 8px 8px;
}
.mu-writer-ruler {
width: min(100%, 49rem);
height: .54rem;
margin: 0 auto clamp(.7rem, 1.6cqi, 1.3rem);
opacity: .82;
background:
repeating-linear-gradient(to right, var(--wr-ticks) 0 1px, transparent 1px 40px) left bottom / 100% 100% no-repeat,
repeating-linear-gradient(to right, var(--wr-ticks) 0 1px, transparent 1px 8px) left bottom / 100% 40% no-repeat;
}
.mu-writer-sheet {
--wr-margin: clamp(1.5rem, 6.5cqi, 5rem);
position: relative;
width: min(100%, 49rem);
margin-inline: auto;
background: var(--wr-sheet);
border: 1px solid var(--wr-rule);
box-shadow: 0 2px 4px #0000000a, 0 8px 22px -16px #0008;
}
.mu-writer-sheet::before, .mu-writer-sheet::after {
content: "";
z-index: 1;
position: absolute;
width: .62rem;
height: .62rem;
pointer-events: none;
border-color: var(--wr-ticks);
border-style: solid;
opacity: .7;
}
.mu-writer-sheet::before { top: .78rem; left: .78rem; border-width: 1px 0 0 1px; }
.mu-writer-sheet::after { right: .78rem; bottom: .78rem; border-width: 0 1px 1px 0; }
.mu-writer-copy {
min-height: 22rem;
padding: clamp(2.15rem, 5.2cqi, 4.25rem) var(--wr-margin) clamp(2.3rem, 5.4cqi, 4.5rem);
color: var(--wr-ink);
outline: 0;
caret-color: var(--wr-ink);
overflow-wrap: anywhere;
white-space: pre-wrap;
font: 400 clamp(1.06rem, 1.65cqi, 1.23rem)/1.68 var(--wr-serif);
}
.mu-writer-copy:focus-visible { outline: 2px solid var(--wr-muted); outline-offset: -2px; }
.mu-writer-copy:empty::before { content: attr(data-placeholder); color: var(--wr-muted); pointer-events: none; }
.mu-writer-copy ::selection { background: var(--wr-ink); color: var(--wr-sheet); }
.mu-writer-copy :where(h2,h3,p,ul,ol,blockquote) { margin: 0; }
.mu-writer-copy > * + * { margin-block-start: .9em; }
.mu-writer-copy h2 {
font: 400 clamp(2.25rem, 5.4cqi, 4.4rem)/1.03 var(--wr-serif);
letter-spacing: -.055em;
text-wrap: pretty;
}
.mu-writer-copy h3 {
font: 600 clamp(1.3rem, 2.6cqi, 1.9rem)/1.2 var(--wr-serif);
letter-spacing: -.037em;
}
.mu-writer-copy > :is(h2,h3):not(:first-child) { margin-block-start: 1.15em; }
.mu-writer-copy :is(ul,ol) { padding-inline-start: 1.4em; }
.mu-writer-copy ul { list-style: disc; }
.mu-writer-copy ol { list-style: decimal; }
.mu-writer-copy a { color: inherit; text-decoration: underline; text-underline-offset: .15em; }
.mu-writer-copy blockquote {
padding-inline-start: .85em;
border-inline-start: .12em solid currentColor;
font: italic 400 clamp(1.42rem, 3.3cqi, 2.15rem)/1.25 var(--wr-serif);
letter-spacing: -.035em;
}
.mu-writer-code:has([data-source][hidden]) { display: none; }
.mu-writer-codehead {
display: flex;
justify-content: space-between;
align-items: center;
gap: .75rem;
padding: .6rem clamp(.75rem, 2.5cqi, 1.75rem);
border-bottom: 1px solid var(--wr-rule);
background: var(--wr-sheet);
font: .76rem/1.3 var(--wr-mono);
}
.mu-writer-codehead button {
display: inline-flex;
align-items: center;
gap: .4rem;
padding: .34rem .58rem;
border: 1px solid var(--wr-rule);
border-radius: .33rem;
color: var(--wr-ink);
background: var(--wr-sheet);
font: inherit;
}
.mu-writer-codehead button:hover { background: var(--wr-wash); }
.mu-writer-codehead svg { width: .88rem; height: .88rem; }
.mu-writer-source {
min-height: 22rem;
max-height: 45rem;
margin: 0;
padding: clamp(1rem, 4cqi, 3rem);
overflow: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
color: var(--wr-ink);
background: var(--wr-side);
font: .88rem/1.8 var(--wr-mono);
}
.mu-writer-source:focus-visible { outline-offset: -3px; }
.mu-writer-source > span { display: block; }
.mu-writer-foot {
justify-content: space-between;
flex-wrap: wrap;
gap: .45rem 1rem;
min-height: 2.45rem;
padding: .5rem clamp(.75rem, 2.5cqi, 1.75rem);
border-top: 1px solid var(--wr-rule);
background: var(--wr-sheet);
color: var(--wr-muted);
font: .69rem/1.3 var(--wr-mono);
}
.mu-writer-foot > span { gap: .42rem; }
.mu-writer-foot svg { width: .85rem; height: .85rem; }
.mu-writer-foot kbd { padding: .14rem .28rem; border: 1px solid var(--wr-rule); border-radius: .24rem; font: inherit; }
.mu-writer-foot .mu-writer-shortcut { gap: .24rem; }
.mu-writer-foot kbd:last-of-type { margin-inline-end: .23rem; }
.mu-writer:has([data-compose][hidden]) .mu-writer-shortcut { display: none; }
.mu-writer-message:empty { display: none; }
.mu-writer-message:not(:empty) { margin: 0; padding: .5rem 1rem; border-top: 1px solid var(--wr-rule); font-size: .85rem; }
@container (max-width: 43rem) {
.mu-writer-outline { display: none; }
.mu-writer-tools { column-gap: .35rem; }
.mu-writer-group { padding-inline-start: .35rem; }
}
@container (max-width: 31rem) {
.mu-writer-head { gap: .45rem; padding: .66rem .65rem; }
.mu-writer-title { gap: .43rem; }
.mu-writer-mark { width: 1.7rem; height: 1.7rem; }
.mu-writer-modes button { padding: .32rem .52rem; }
.mu-writer-tools {
flex-wrap: nowrap;
overflow-x: auto;
overscroll-behavior-inline: contain;
scrollbar-width: thin;
padding: .42rem .55rem;
}
.mu-writer-tools > * { flex-shrink: 0; }
.mu-writer-tools :is(button,select) { min-height: 2.35rem; }
.mu-writer-tools button { width: 2.18rem; }
.mu-writer-tools :is(button,select):focus-visible { outline-offset: -2px; }
.mu-writer-desk { padding: .5rem .55rem .95rem; }
.mu-writer-sheet { --wr-margin: clamp(1.15rem, 6cqi, 1.7rem); }
.mu-writer-foot .mu-writer-shortcut { display: none; }
}
@media (forced-colors: active) {
.mu-writer-modes button[aria-pressed="true"], .mu-writer-tools button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}JavaScript module
const blocks = new Set(['p', 'h2', 'h3', 'blockquote', 'ul', 'ol', 'li']);
const inline = new Set(['strong', 'em', 'u', 'a']);
const discard = new Set(['script', 'style', 'noscript', 'template', 'iframe', 'object', 'embed']);
const aliases = {b: 'strong', i: 'em', div: 'p', h1: 'h2'};
const commands = {bold: 'bold', italic: 'italic', underline: 'underline', ul: 'insertUnorderedList', ol: 'insertOrderedList', clear: 'removeFormat'};
function escapeText(value) {
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
}
function escapeAttribute(value) {
return escapeText(value).replaceAll('"', '"');
}
function safeLink(value, base) {
value = value.trim();
if (!value || /[\u0000-\u001f\u007f]/.test(value)) return '';
try {
const url = new URL(value, base);
if (['http:', 'https:', 'mailto:', 'tel:'].includes(url.protocol)) return value;
} catch { /* Invalid references cannot become links. */ }
return '';
}
// Rebuild a small document vocabulary. The only attribute that survives is a
// checked href. Both imported drafts and the browser's editing markup use it.
function serialize(parent, text, base, sourceLines) {
let html = '';
function append(markup, block = false) {
html += markup;
if (sourceLines) sourceLines.push({markup, block});
}
for (const node of parent.childNodes) {
if (node.nodeType === 3) {
text.push(node.data);
append(escapeText(node.data));
continue;
}
if (node.nodeType !== 1 || node.namespaceURI !== 'http://www.w3.org/1999/xhtml') continue;
const name = node.localName;
if (discard.has(name)) continue;
if (name === 'br') {
text.push(' ');
append('<br>');
continue;
}
const tag = Object.hasOwn(aliases, name) ? aliases[name] : name;
if (blocks.has(tag)) text.push(' ');
let inner = serialize(node, text, base);
if (blocks.has(tag)) text.push(' ');
if (tag === 'a') {
const href = safeLink(node.getAttribute('href') || '', base);
if (href) inner = '<a href="' + escapeAttribute(href) + '">' + inner + '</a>';
} else if (name === 'span') {
const style = node.style;
if (style.fontWeight === 'bold' || Number(style.fontWeight) >= 600) inner = '<strong>' + inner + '</strong>';
if (style.fontStyle === 'italic') inner = '<em>' + inner + '</em>';
if (style.textDecorationLine.includes('underline')) inner = '<u>' + inner + '</u>';
} else if (blocks.has(tag) || inline.has(tag)) {
// Chromium can leave a list inside the original paragraph after an
// insertList command. Such wrappers would split when reloaded as HTML.
if (!['p', 'h2', 'h3'].includes(tag) || !node.querySelector('p,div,h1,h2,h3,ol,ul,blockquote')) {
inner = '<' + tag + '>' + inner + '</' + tag + '>';
}
}
append(inner, blocks.has(tag));
}
return html;
}
export function mount(root) {
const doc = root.ownerDocument;
const get = selector => root.querySelector(selector);
const field = get('[data-field]');
const editor = get('[data-editor]');
const toolbar = get('[data-toolbar]');
const compose = get('[data-compose]');
const source = get('[data-source]');
const block = get('[data-block]');
const linkPanel = get('[data-link-panel]');
const url = get('[data-link-url]');
const message = get('[data-message]');
const outline = get('[data-outline]');
const outlinePanel = get('[data-outline-panel]');
const countLabel = get('[data-count]');
const toggles = [...root.querySelectorAll('[data-action][aria-pressed]')];
const modes = [...root.querySelectorAll('[data-mode]')];
if (!field || !editor || !doc.execCommand || root.dataset.enhanced === 'true') return;
let saved = null;
let mode = 'write';
let labels = [];
let history = [];
let position = 0;
let typing = '';
let lastEdit = 0;
let lastCommitted = '';
const selection = () => doc.getSelection();
function remember() {
const sel = selection();
if (sel.rangeCount && editor.contains(sel.getRangeAt(0).commonAncestorContainer)) {
saved = sel.getRangeAt(0).cloneRange();
}
}
function select(range) {
editor.focus({preventScroll: true});
const sel = selection();
sel.removeAllRanges();
sel.addRange(range);
remember();
}
function restore() {
if (saved && editor.contains(saved.commonAncestorContainer)) return select(saved);
const range = doc.createRange();
range.selectNodeContents(editor);
range.collapse(false);
select(range);
}
// Bookmarks survive rebuilding the DOM during undo/redo. All history is
// per editor so a second form field cannot undo edits in the first.
function edge(node, offset) {
const path = [];
while (node !== editor) {
const parent = node.parentNode;
path.unshift(Array.prototype.indexOf.call(parent.childNodes, node));
node = parent;
}
return {path, offset};
}
function bookmark() {
if (!saved || !editor.contains(saved.commonAncestorContainer)) return null;
return [edge(saved.startContainer, saved.startOffset), edge(saved.endContainer, saved.endOffset)];
}
function locate(point) {
let node = editor;
for (const index of point.path) {
if (!node.childNodes[index]) break;
node = node.childNodes[index];
}
return [node, Math.min(point.offset, node.nodeType === 3 ? node.length : node.childNodes.length)];
}
function updateTools() {
const start = saved?.startContainer;
const element = start?.nodeType === 1 ? start : start?.parentElement;
const heading = element?.closest('h2,h3');
if (block) block.value = heading && editor.contains(heading) ? heading.localName : 'p';
const selectionIsHere = editor.contains(selection()?.anchorNode);
for (const button of toggles) {
const action = button.dataset.action;
// Toolbar and view buttons can have bold text of their own. Keep the
// last editing state while the selection belongs to another control.
if (start && !selectionIsHere) continue;
const active = start && (action === 'quote' ? element?.closest('blockquote') :
doc.queryCommandState(commands[action]));
button.setAttribute('aria-pressed', String(Boolean(active)));
}
get('[data-action="undo"]').disabled = position === 0;
get('[data-action="redo"]').disabled = position >= history.length - 1;
}
function updateOutline() {
if (!outline) return;
const headings = [...editor.querySelectorAll('h2,h3')];
const entries = headings.map((h, index) => ({index, level: h.localName, label: h.textContent.trim()})).filter(item => item.label);
outlinePanel.hidden = mode !== 'write' || !entries.length;
if (entries.length === labels.length && entries.every((e, i) =>
e.label === labels[i].label && e.level === labels[i].level && e.index === labels[i].index)) return;
labels = entries;
outline.replaceChildren(...entries.map(entry => {
const button = doc.createElement('button');
button.type = 'button';
button.dataset.level = entry.level;
button.dataset.index = entry.index;
button.textContent = entry.label;
return button;
}));
}
function sync(kind = '', notify = true) {
const text = [];
const lines = mode === 'html' ? [] : null;
let html = serialize(editor, text, doc.baseURI, lines);
const words = text.join('').match(/\S+/gu)?.length || 0;
if (!words) html = '';
countLabel.textContent = words + (words === 1 ? ' word' : ' words');
if (lines) source.replaceChildren(...(html ? lines : []).map(({markup, block}) => {
if (!block) return doc.createTextNode(markup);
const line = doc.createElement('span');
line.textContent = markup;
return line;
}));
if (field.value !== html) {
field.value = html;
if (notify) field.dispatchEvent(new Event('input', {bubbles: true}));
}
remember();
if (history[position]?.html !== html) {
const now = Date.now();
const state = {html, selection: bookmark()};
history.splice(position + 1);
if (kind && kind === typing && now - lastEdit < 1000) history[position] = state;
else {
history.push(state);
if (history.length > 50) history.shift();
position = history.length - 1;
}
lastEdit = now;
typing = kind;
}
updateOutline();
updateTools();
}
function step(delta) {
const target = position + delta;
if (!history[target]) return;
position = target;
typing = '';
const state = history[target];
editor.innerHTML = state.html;
saved = null;
if (state.selection) {
const range = doc.createRange();
range.setStart(...locate(state.selection[0]));
range.setEnd(...locate(state.selection[1]));
select(range);
} else restore();
sync();
}
function command(name, value) {
restore();
typing = '';
history[position].selection = bookmark();
doc.execCommand(name, false, value);
sync();
}
function onSelection() {
remember();
updateTools();
}
function closeLink() {
linkPanel.hidden = true;
url.removeAttribute('aria-invalid');
if (message) message.textContent = '';
get('[data-action="link"]').setAttribute('aria-expanded', 'false');
}
function openLink() {
remember();
restore();
const start = saved.startContainer;
const anchor = (start.nodeType === 1 ? start : start.parentElement)?.closest('a');
url.value = anchor?.getAttribute('href') || '';
if (anchor && saved.collapsed) {
const range = doc.createRange();
range.selectNodeContents(anchor);
select(range);
}
linkPanel.hidden = false;
get('[data-action="link"]').setAttribute('aria-expanded', 'true');
url.focus();
url.select();
}
function applyLink() {
const href = safeLink(url.value, doc.baseURI);
const start = saved?.startContainer;
const inLink = (start?.nodeType === 1 ? start : start?.parentElement)?.closest('a');
if (!url.value.trim() && inLink) {
closeLink();
command('unlink');
} else if (!href) {
url.setAttribute('aria-invalid', 'true');
if (message) message.textContent = 'Enter a web address, email link, phone link, or relative path.';
url.focus();
} else {
closeLink();
if (saved?.collapsed) command('insertHTML', '<a href="' + escapeAttribute(href) + '">' + escapeText(href) + '</a>');
else command('createLink', href);
}
}
function switchMode(next) {
remember();
closeLink();
mode = next;
root.dataset.view = next;
toolbar.hidden = compose.hidden = next === 'html';
source.hidden = next !== 'html';
for (const button of modes) button.setAttribute('aria-pressed', String(button.dataset.mode === next));
sync();
}
async function copySource() {
const value = field.value;
try {
await doc.defaultView.navigator.clipboard.writeText(value);
message.textContent = 'HTML copied.';
} catch {
const range = doc.createRange();
range.selectNodeContents(source);
source.focus();
const sel = selection();
sel.removeAllRanges();
sel.addRange(range);
message.textContent = 'HTML selected. Use your copy shortcut to copy it.';
}
}
function initialize(value) {
// A template stays inert, including external resources, while parsing the
// initial value. Only serialized, allowlisted markup enters the live DOM.
const isDefault = value === field.defaultValue;
const template = doc.createElement('template');
template.innerHTML = value;
editor.innerHTML = serialize(template.content, [], doc.baseURI);
saved = null;
history = [];
position = 0;
typing = '';
sync('', false);
// Native reset (and immediately reading FormData after reset) should
// restore the same serialized HTML, even before the reset microtask runs.
if (isDefault) field.defaultValue = field.value;
lastCommitted = field.value;
}
toolbar.addEventListener('mousedown', event => {
remember();
if (event.target.closest('[data-action]')) event.preventDefault();
});
toolbar.addEventListener('click', event => {
const action = event.target.closest('[data-action]')?.dataset.action;
if (!action) return;
if (action === 'link') {
if (linkPanel.hidden) openLink();
else { closeLink(); restore(); }
return;
}
closeLink();
if (action === 'undo' || action === 'redo') step(action === 'undo' ? -1 : 1);
else if (action === 'quote') {
const pressed = get('[data-action="quote"]').getAttribute('aria-pressed') === 'true';
command('formatBlock', pressed ? 'p' : 'blockquote');
} else if (commands[action]) command(commands[action]);
});
block.addEventListener('change', () => command('formatBlock', block.value));
get('[data-link-apply]').addEventListener('click', applyLink);
get('[data-link-cancel]').addEventListener('click', () => { closeLink(); restore(); });
linkPanel.addEventListener('keydown', event => {
if (event.key === 'Escape' || (event.key === 'Enter' && event.target === url)) {
event.preventDefault();
if (event.key === 'Enter') applyLink();
else { closeLink(); restore(); }
}
});
for (const button of modes) button.addEventListener('click', () => switchMode(button.dataset.mode));
get('[data-copy-source]')?.addEventListener('click', copySource);
outline?.addEventListener('click', event => {
const button = event.target.closest('[data-index]');
const heading = button && editor.querySelectorAll('h2,h3')[Number(button.dataset.index)];
if (!heading) return;
const range = doc.createRange();
range.selectNodeContents(heading);
range.collapse(true);
select(range);
heading.scrollIntoView({block: 'nearest'});
});
editor.addEventListener('focus', () => doc.addEventListener('selectionchange', onSelection));
editor.addEventListener('blur', () => {
doc.removeEventListener('selectionchange', onSelection);
remember();
typing = '';
if (lastCommitted !== field.value) {
lastCommitted = field.value;
field.dispatchEvent(new Event('change', {bubbles: true}));
}
});
editor.addEventListener('pointerdown', () => { typing = ''; });
editor.addEventListener('keydown', event => {
if (event.isComposing) return;
const key = event.key.toLowerCase();
if (event.altKey || !(event.ctrlKey || event.metaKey)) {
if (key.startsWith('arrow') || key === 'home' || key === 'end') typing = '';
return;
}
if (key === 'k' || key === 'z' || key === 'y') {
event.preventDefault();
if (key === 'k') openLink();
else step(key === 'y' || event.shiftKey ? 1 : -1);
}
});
editor.addEventListener('beforeinput', event => {
if (event.inputType === 'historyUndo' || event.inputType === 'historyRedo') {
if (event.cancelable) {
event.preventDefault();
step(event.inputType === 'historyUndo' ? -1 : 1);
}
return;
}
remember();
history[position].selection = bookmark();
});
editor.addEventListener('input', event => {
const kind = ['insertText', 'deleteContentBackward', 'deleteContentForward'].includes(event.inputType) ? event.inputType : '';
sync(kind);
});
editor.addEventListener('paste', event => {
event.preventDefault();
remember();
const text = event.clipboardData?.getData('text/plain');
if (text) command('insertText', text);
});
editor.addEventListener('dragover', event => {
event.preventDefault();
if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';
});
editor.addEventListener('drop', event => {
event.preventDefault();
const text = event.dataTransfer?.getData('text/plain');
if (!text) return;
const caret = doc.caretPositionFromPoint?.(event.clientX, event.clientY);
const range = caret ? doc.createRange() : doc.caretRangeFromPoint?.(event.clientX, event.clientY);
if (caret) range.setStart(caret.offsetNode, caret.offset);
if (range && editor.contains(range.startContainer)) {
range.collapse(true);
select(range);
}
command('insertText', text);
});
field.form?.addEventListener('reset', event => queueMicrotask(() => {
if (event.defaultPrevented) return;
initialize(field.defaultValue);
switchMode('write');
}));
const initialValue = field.value;
if (initialValue !== field.defaultValue) initialize(field.defaultValue);
initialize(initialValue);
root.dataset.enhanced = 'true';
field.hidden = true;
switchMode('write');
}Use the HTML in a static site
Copy the rendered HTML above. Download these assets into the same folder as your page, then add the tags below to its head.
Shared CSS Component CSS Ready-to-use module
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./wysiwyg-editor.css">
<script type="module" src="./wysiwyg-editor.js"></script>Copy into your project
Run this command from the Mono checkout. Set -out to the component directory in your application.
go run ./cmd/mono-ui add -out ./components wysiwyg-editorExample properties (JSON)
{
"Label": "Pressroom notes",
"Name": "article_body",
"Placeholder": "Start your draft…",
"Value": "\u003ch2\u003eThe shape of silence\u003c/h2\u003e\u003cp\u003eThe first proof came off the press still warm. I held it up to the window. One line sat too close to the fold, so I moved it the width of my thumb.\u003c/p\u003e\u003cblockquote\u003eSometimes the best mark on a page is the space you leave beside it.\u003c/blockquote\u003e\u003ch3\u003eOn the proofing table\u003c/h3\u003e\u003cp\u003eWe kept the rough stock and the heavy ink. On the second proof, the word \u003cem\u003eriver\u003c/em\u003e had a whole line to itself.\u003c/p\u003e"
}