A small JS enhancement

Widowmender

The opposite of a widowmaker: it reunites the last word with its line.

Vol. 1 · No. widows Tightens tracking, not the whole graf

A widow is the short final line of a paragraph or heading left holding just one small word, orphaned below the rest of the text. Widowmender catches it after layout, borrows a sliver of tracking from the line above so the word gets pulled back up, and only reaches for a non‑breaking space if tightening alone can't rescue it.

Want to use Widowmender on your website? Download it from GitHub.

01

What a widow looks like

Hand-set here to show the failure mode plainly: a single word stranded on its own line, dangling below the rest of its paragraph.

Building in public changes how the
work feels, even when the finished
thing always turns out exactly the
same.

Unmended: "same." left alone on its own line
02

Drag the corner. Watch it get caught.

This paragraph is live: processed by Widowmender on load, on resize, and once webfonts settle. Narrow the box until a word strands itself on the last line, then keep dragging and watch the fix engage a beat later.

widow · paragraph measuring...

Every paragraph eventually runs out of room, and the line that's left over doesn't always land cleanly. Sometimes it's a single short word, stranded below a much longer line, looking like a mistake even though nothing about the writing was wrong after all.

Drag the resize handle at the bottom-right corner of the text block above
03

Headings widow too

Same script, same selector: no special-casing for headline type.

widow · heading measuring...

Websites and web apps for your business

Drag the resize handle at this one's corner too
04

Drop it in

Add the class to anything you want protected, then call init once. No build step.

<p class="widow">...</p> <script src="widow-mender.js"></script> <script>Widowmender.init()</script>