← ContentsThe Consilience Student Knowledge PackAbout

Poetry is the hardest content to parse, and the reason is simple: publishers have never agreed on how to mark it up. Prose is prose — paragraphs follow paragraphs, headings announce themselves, blockquotes indent. But a poem might arrive as a sequence of <div> elements, each holding a single line. Or as a single <p> with <br> tags between lines. Or as a <table> where each row is a line and the left column holds line numbers. Or as a <pre> block with manual spacing. Or as a <span> inside a <span> inside a container whose class name is the only clue that anything poetic is happening at all.

The detection system recognizes eight forms. Stanzaic — the most common, used by publishers who care about typography. Each stanza is a <div>, each line is a <div> or <span> within it. Edgar Allan Poe's "The Raven" typically arrives this way, its Gothic architecture preserved in nested containers that echo the poem's own recursive structure. Line-per-div — Dickinson's compressed quatrains, each line its own element, the white space between stanzas implied by a slightly taller margin on every fourth line. Line-per-p — the trade publisher's compromise: the whole poem in one paragraph, line breaks marked by <br/>, which is fast to produce and brutal to anything that needs to know where one stanza ends and another begins.

Prose-poem — Baudelaire's invention, a single block of justified text that is unmistakably a poem but carries none of the structural markers. Detected by density of language rather than layout. Table-layout — a <table> where column A holds line numbers and column B holds the verse, common in older scholarly editions. The detector knows to extract only the verse column and discard the numbering. Block-container — a <div> with display: block and a class name that whispers "poetry" to anyone paying attention. Preformatted — a <pre> block, usually monospaced, usually from Project Gutenberg, where the poem was typed out with spaces by someone who trusted the reader's eye more than HTML's renderer. Scriptural — the Bible, the Psalms, any text where verse numbers are part of the content and must be preserved alongside the poetry rather than stripped.

The trade publisher class-name heuristics are a small dictionary of hope: poemt, poem, VER1_Verse, VER2_Verse, txt-hang. These are not standards. They are habits. Some production team at some publishing house decided, twenty years ago, that poems would get the class poemt and their conversion vendor coded to that assumption. The detector does not judge. It recognizes.

Inline markup — italic, bold, small caps, the typographic gestures that poets use to bend language — is preserved through every transformation. The HAST-to-MDAST bridge handles inline formatting differently from block formatting, and the plugin is careful not to flatten what the poet placed. A Dickinson dash rendered in italics survives the pipeline intact.

The output is a unified section element. Every poem from every source, regardless of how it was originally marked up, arrives at the same predictable format: a <section> containing stanzas, each stanza containing lines, with inline markup preserved and line numbers where the source provided them. The folio surface can render any poem from any publisher without knowing anything about how that publisher chose to encode verse. The pipeline absorbed the chaos. The surface sees only order.

22. Poetry DetectionListening