The op log learned nothing, so the grammar learned everything
A pipe table pasted into outl arrived as a wall of pipes plus one unrecognized_block_marker warning per row. Modelling it as a block whose text carries the rows, with no Op::Table and no new wire shape, kept the op log, the sidecar and every client's DTO unchanged. The price landed everywhere else: a construct recognised by shape rather than by a marker swallowed three lines that belonged to other constructs, one of which froze a page through invariant 8's false-positive direction; consolidating a pre-329 sidecar orphans 100% of a table-heavy page and ran straight into the bulk-delete guard, where subtracting the exemption from both sides of the ratio refused an ordinary 20-of-85 delete as 80%; and padding every row to the widest one is quadratic, so a 17 KB block became 1.6M cell vectors and a 9 MB string the TUI rebuilt on every repaint. All three parser bugs were found by a generator, not by anyone enumerating shapes.
A markdown table pasted into outl arrived as one warning per row.
Nothing was lost. The parser had no table in its grammar, so each pipe line failed the block-marker check, went down the permissive-recovery path in crates/outl-md/src/parse.rs, and came back as its own block carrying an unrecognized_block_marker warning. Four rows, four warnings, and a file that was entirely correct looked broken to anybody reading the banner. Issue #329 asked for tables to render as tables.
a table is not a new block kind, because the op log is the expensive place to put one
The first decision is the one everything else in this change is downstream of: there is no Op::Table. A table is a block whose text carries the pipe rows, exactly the shape a fenced code block and a > quote already have.
That is not a small saving. A new block kind costs an Op variant, which costs a wire format change, which costs a sidecar migration and a second opinion in every client about what a table is. outl’s op log is append-only per actor and replays on every device, including devices running an older binary off TestFlight, so a new variant is a thing you cannot take back. The alternative was free in exactly the way that matters: the existing continuation grammar already round-trips a multi-line block’s text, so the log never learns a new shape and no client gains a branch for a node kind it has never seen. The public Rust surface only gains names (parse_table, render_table, table_span, tokenize_table, TableView, ColumnAlign), and BlockNode.table is an optional field an older client ignores.
So nothing in the op log changed, and nothing in the sidecar changed. What I want to be honest about is where the work went instead, because it did not evaporate. It went into the grammar, the migration guard, the renderer and the clipboard reader, which between them are the four places in this codebase least equipped to refuse bad input.
recognised by shape, so it can swallow a line another construct owns
A fence is a fence because it starts with three backticks. A quote is a quote because it starts with > . A table has no marker. It is a line carrying a pipe, then a delimiter row, then every following line that also carries a pipe, and that is the entire definition in table_span.
Which makes it the one construct in the dialect that can claim a line meant for something else. crates/outl-md/src/table.rs ended up with a predicate whose whole job is refusing those lines:
fn is_row(line: &str) -> bool {
let trimmed = line.trim();
if !has_unescaped_pipe(trimmed) {
return false;
}
if trimmed == "-" || trimmed.starts_with("- ") {
return false;
}
if trimmed.starts_with("```") || trimmed.starts_with("~~~") {
return false;
}
crate::parse::parse_property_line(trimmed).is_none()
}
Three refusals, one per shape that got through. A bullet carrying a pipe (- item | with a pipe) written under a table is a sibling block; absorbed into the table’s text it re-renders at indent + 1, where the next parse reads it as a child, so the user’s block migrates inside the table and the file keeps changing on every save. A status:: x | y line is a property; absorbed, the reparse lifts it back into properties, so the reconcile emits an Op::Edit plus a SetProp for a line nobody touched. A row opening with three backticks opens a fence in the continuation grammar, and the render appends a closing fence on every pass, which grows without bound.
The first one is not merely churn. - | - satisfies is_delimiter_row, because every cell of it is dash-shaped. Read the table around that bullet and content_lines_missing_from reports a line the op log does hold, which withholds last_synced_hash and refuses re-projection. That is invariant 8’s false-positive direction, the one that freezes a page in both directions with nothing wrong with it, reached here from a new angle after a page with nothing to lose was refused because its sidecar could not speak for it. So table_span asks is_row of the delimiter row too, not only of the header and the body, and that is why the two checks are not interchangeable.
The ordering inside is_row is also load-bearing, for a duller reason. parse_property_line allocates two Strings when it matches, and block_to_rows in crates/outl-md/src/view.rs asks this question of every visible block on every frame. Running the property check first allocated on every collapsed:: and remind:: line the outline drew. The pipe test is both the cheapest and the most discriminating, so it goes first.
three parser bugs, and no human found any of them
Here is the part I would not have predicted. All three of those shapes were found by arb_table_block, a proptest generator added to crates/outl-md/tests/block_text_roundtrip_properties.rs. None of them came from a hand-written case, and I had written a lot of hand-written cases.
That file already ran three properties over generated block text: no line is lost across parse → render, render → parse is a fixpoint rather than merely lossless, and the unlogged-content check does not cry wolf. Before this change nothing in those runs crossed the table code, because the generator produced prose, fences, unicode and indentation, and a table is none of those. Adding a generator that emits a header, a delimiter row and a body put the table grammar under all three properties on every run.
The generator also found four holes in its own construction before it went green, and two of them are documented in the source because they are the same class of bug as the ones it caught. A single-column table with no outer pipes carries no pipe at all, so it is a line of prose followed by -, which is a bullet. A table whose first rule cell is a bare - with no outer pipes starts with - , which is also a bullet. Those two are now forced to carry outer pipes by the generator, and the bullet-shaped delimiter row lives in the literal list beside it:
1 => Just("a | b\n- | -\n1 | 2".to_string()),
1 => Just("| a | b |\n| - | - |\nstatus:: x | y".to_string()),
1 => Just("| a | b |\n| - | - |\n```| x |".to_string()),
Three corpus files carry the same shapes as whole documents. I checked table_bullet_rule.md does its job the only way that proves anything: by deleting the delimiter guard and watching both the fixpoint property and the unlogged-content property fail.
The lasting fix is the generator, not the three guards. The guards are correct against the three shapes that exist today. The generator is what crosses the table grammar on every run for shapes nobody has thought of, and the measured fact behind that preference is not new in this repo: across the whole of issue #210 and the four regressions introduced while fixing it, every defect was found by running code over real or generated documents, and none by a unit suite that was green at every one of those moments.
the migration orphans the whole page, and the obvious denominator refuses the rest
A sidecar written before this shipped records one block per table row, because that is what the parser produced. The pass that consolidates those rows into one table block therefore orphans every one of them, and on a page that is mostly a table that is 100% of its known blocks. OrphanGuard refuses a reconcile that proposes to trash more than 75% of a page’s previously-known blocks, which is exactly the right policy and exactly wrong here: nothing is written on a refusal, so the next pass sees the same inputs and refuses again, for good.
The exemption goes through match_blocks_guarded_except in crates/outl-md/src/matching/guard.rs, the same hook the pre-frontmatter migration uses. That hook exists because of a block append that put four lines of somebody else’s YAML metadata into the op log as bullets, and it has the same discipline attached: the predicate is positive evidence, not a bypass. TableLines is an occurrence-counted multiset built from the tables on disk right now, and an orphan is exempt only when its text is one of those lines. A truncated .md, which is the thing the guard exists for, has no table on disk and gets no discount. A row whose cell the user also edited is not a line on disk and still counts. One line on disk exempts at most one orphan, so a single row cannot vouch for a thousand deleted duplicates. The rows are trashed and written to orphans.log either way: this changes what the guard counts, never what the pass deletes.
The interesting bug is the arithmetic. The obvious move is to take the exempt set off both sides of the ratio, and that is wrong in the direction that refuses real work:
let volume = OrphanVolume {
orphaned: orphans.len().saturating_sub(exempt),
previously_known: old_blocks.len(),
};
(O - E) / (K - E) >= O / K whenever E is positive, so subtracting from the denominator raises the ratio for every orphan that is not exempt. This was harmless while the only predicate was the YAML fence one, which exempts four or five lines. TableLines routinely exempts dozens. A page with a 60-row table and 25 prose bullets, 20 of which the user cleared in an editor, measured as “20 of 25 known blocks, 80%” and was refused. The honest figure is 20 of 85, which is 24%, well inside a ceiling set high on purpose so ordinary section-clearing never trips it. A guard that fires on ordinary editing gets disabled, and then it guards nothing.
nothing is dropped is quadratic, so there is a cap
Two deliberate departures from GFM, both in the same direction. The GFM tables extension truncates a row carrying more cells than the header and pads a short one; outl pads the short row the same way and widens the table for the long one. A cell you can see in your editor and cannot see in outl is the loss this crate exists to prevent.
The bill for that arrives immediately. Table::columns() is the widest row and every other row pads to it, so a ragged table costs columns × rows in a way a rectangular one does not. Measured through the real pipeline before the cap existed: a 17 KB block holding a 4,000-cell header over 400 one-cell rows materialised 1.6 million Vec<InlineToken>, a 4 MB wire payload to the client, and a 9 MB string that the terminal client rebuilt on every repaint. At 109 KB the same shape is gigabytes. That .md arrives over iroh or iCloud or Syncthing from another device, so opening the page is the entire interaction, and it re-triggers on every projection.
So parse_table refuses past 65,536 materialised cells, checked once in the single owner of the reading rather than in each of the four consumers:
if table.columns().saturating_mul(table.rows.len() + 1) > MAX_TABLE_CELLS {
return None;
}
Refusing there is lossless and is already a defined outcome. The block’s text is untouched, table_span still claims it as one block, and a None is what every client already handles: it falls back to tokens and shows the pipe rows verbatim, which is precisely what every client did before tables were modelled. 65,536 is 16 columns by 4,096 rows, far past anything hand-written and far below where the padding hurts.
the clipboard is where the hostile input actually arrives
Three clipboard shapes converge on one markdown table before anything is written: a <table> in text/html, tab-separated text/plain, and a markdown table copied from a README or an assistant’s reply. One table reader rather than three.
Turndown ships no table rule, so crates/outl-frontend-shared/src/paste/table.ts is it, and that file is where the modelling work that did not go into a type shows up most plainly. colspan is read off the DOM with getAttribute, which returns the literal attribute: colspan="2000000000" asked for a 16 GB array, and colspan="50000000" froze the webview for seconds before throwing RangeError: Invalid string length. Both are clamped now. The column count is a reduce rather than Math.max(...spread), because a spread is an argument list and a 200,000-row table overflows the call stack. A <table> nested inside a cell donated its rows to the outer grid until the selector became :scope >, which duplicated content out of any HTML email built on layout tables.
The escape has the same shape on both sides of the language boundary. A spreadsheet cell holding foo\|bar, which is ordinary sed or grep alternation and needs no attacker, becomes foo\\|bar if you escape the pipe blindly. That is an even run of backslashes, which split_cells reads as a real delimiter: three cells where the user had two, every later value under the wrong header, written to the op log. crates/outl-md/src/table/import.rs doubles the backslash; the TypeScript counts the run before deciding. Two implementations of one escape rule, which is the thing this repo spends most of its review effort deleting, and here it is unavoidable because HTML never reaches Rust.
The detectors that gate all of this ask outl_md::table_span at every line rather than looking for a pipe, so the clipboard router’s answer cannot disagree with what the parser will do with the same text. Comma-separated text is deliberately not tabular, because prose carries commas, and tab-indented code is excluded by requiring that no line starts with a tab.
what it cost
outl never reformats a table you wrote. Re-emitting every table column-padded on read is a whitespace-only rewrite of a hand-written file, and the reconcile that follows turns it into an Op::Edit per table: churn in the log for a space nobody typed. So alignment is a render decision, and render_table is only used where outl creates a table. The terminal client pads when it paints, in crates/outl-tui/src/view/table.rs, and pays for that with a known gap: it measures a cell at its shown width, so [[Avelino]] measures 7 and not 11, but a cell that is only a ((blk-…)) resolves against the workspace index at paint time and flattens to nothing in the measure, so that one cell still misaligns the column. Closing it means handing the index to the measurement, which is a wider change than this one.
The property-line refusal has a user-visible price. A table written without outer pipes whose first cell starts key:: stops at that row, and the row becomes a recovered block with a warning. With outer pipes the key would be | title, which is not a valid key, so the row is kept. That is a genuinely ambiguous line and the property wins, because outl writes properties itself and absorbing one into a table’s text would make the reparse disagree with the parse.
Capability::TableRendering is Partial on the terminal client: a table wider than the pane wraps instead of scrolling sideways, every row still there, the columns no longer lining up. That wording lives in crates/outl-shortcuts/src/capability_support.rs rather than in the client, so there is one copy of it. There is no add-row or add-column UI on any client, by design; editing a table is editing its markdown.
And the honest one: 82 files, 6,222 insertions, 2,113 deletions. That is not reviewable in one sitting and I would rather say so than pretend otherwise. I also never ran the desktop or mobile app against a real paste. The grid, the <table> and the horizontal scroll are covered by unit tests and by tsc, not by me watching them work, and crates/outl-actions/tests/table_pipeline.rs only proves the path from a .md on disk through the op log to the DTO a client reads.
the question to ask before you skip a type
Declining to give something a type feels like avoiding the modelling work. It is not. The modelling work is conserved, and skipping the type relocates it from the one place designed to refuse bad input, a tagged enum with an exhaustive match, into the places that have to accept whatever arrives: a grammar reading somebody’s hand-written file, a migration guard whose job is refusing deletions, a renderer in a repaint loop, and a clipboard parser reading attributes off a DOM that an HTML email wrote.
That was still the right call here, because an Op variant is forever and a grammar rule is not. But the trade is only honest if you go and look at every one of those places, and the reason this one came out right is not that I enumerated the shapes a table could swallow. I enumerated several and missed all three that mattered. A generator found them, on a property that already existed, the first time anything made it cross this code.
The dialect lives in crates/outl-md/src/table.rs, the guard exemption in crates/outl-md/src/matching/guard.rs with its caller in crates/outl-md/src/reconcile.rs, the generator in crates/outl-md/tests/block_text_roundtrip_properties.rs, and the shared grid in crates/outl-frontend-shared/src/markdown/MarkdownTable.tsx. The issue is #329 in the outl repository.