Skip to content

docs(specs): markdown viewer HTML <table> support (GH13726) - #14242

Open
fbartho wants to merge 11 commits into
warpdotdev:masterfrom
fbartho:fb/13726-markdown-html-tables-spec-2
Open

fbartho wants to merge 11 commits into
warpdotdev:masterfrom
fbartho:fb/13726-markdown-html-tables-spec-2

Conversation

@fbartho

@fbartho fbartho commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Closes #13726

The focused raw-HTML <table> issue split out of #13652 per maintainer guidance there. Sibling spec draft: <img> sizing (#13656, now targeting #13721); <br> handling has its own issue (#13732).

What

Spec (product.md + tech.md, per CONTRIBUTING's spec-first workflow for feature requests) for teaching the Markdown viewer to render raw-HTML <table> markup (<thead>/<tbody>/<tr>/<th>/<td>) by mapping it onto Warp's existing table model and render path, and to honor <br> inside cells.

Why

Warp already renders GFM pipe-tables (behind MarkdownTables). The issue asks for HTML tables specifically for the two things GFM syntax cannot express: cells with a hard line break (<br>) and cells that span columns/rows (colspan/rowspan). Raw <table> markup is currently dropped.

Highlights

  • Recognize a block-level HTML <table> and render it through the existing table layout/render/scroll/selection path — same appearance as an equivalent GFM table.
  • <th>/<thead> → header row, <td> rows → data; inline formatting and inline images (per docs(specs): markdown viewer raw-HTML <img> support (rendering + sizing) (GH13721) #13656) render inside cells.
  • Honor <br> inside a cell as an authored hard line break — the primary capability GFM pipe tables lack. The renderer already does multi-line cells (wrapping); this makes the break first-class.
  • Alignment via align/text-align; ragged rows normalized; only structural tags + alignment attributes read; no script/navigation.
  • Rides the existing MarkdownTables feature flag; no GFM-table behavior change.

Honest scope note (three slices, sized)

  • Simple HTML table → small: it is a rectangular grid, maps onto the existing FormattedTable with zero editor changes — but barely beats GFM pipe tables.
  • <br> in cells → medium: the value-add. The renderer supports multi-line cells, but the cell type and the internal round-trip format (which uses \n as the row delimiter) can't represent an authored break, so it needs a cell-model + serialization change. This spec commits to it.
  • colspan/rowspan → large, explicit non-goal here: the flat rectangular grid (one width/column, one height/row, [row][col] indexing) is baked into the data model, layout, painter, and offset maps. Spanning needs a non-rectangular grid across all of them. Degraded to a single ordinary cell (span ignored — no crash, no corrupt grid) and deferred to Markdown viewer: colspan/rowspan support for raw HTML tables #13953.

Flagging the cell-model change (touches the shared FormattedTable type) and the simple-vs-<br> split as the key decisions for review — happy to split simple-table and <br> into two PRs if you'd prefer.

Process note

Supersedes #13661 (same spec; that PR's /oz-review budget was exhausted, so this fresh PR carries the identical, review-addressed spec forward with a clean budget). #13652 was closed in favor of per-feature issues; this spec targets #13726 with files under specs/GH13726/.

fbartho added 9 commits July 13, 2026 12:05
Warp already renders GFM pipe-tables but drops raw-HTML `<table>` markup. The
issue wants HTML tables specifically for what GFM can't express: `<br>` line
breaks in cells and colspan/rowspan.

This adds the product + tech spec for tier-zero tag warpdotdev#3 of warpdotdev#13652: recognize a
block-level HTML `<table>`/`<thead>`/`<tbody>`/`<tr>`/`<th>`/`<td>` and map it
onto Warp's existing FormattedTable + render path. Scopes the slices honestly:
simple table (small, reuses the whole render chain), `<br>`-in-cell (medium,
needs a cell-type + serialization change — the capability that makes HTML tables
worth having), and colspan/rowspan (large, an explicit non-goal degraded to
single-cell, deferred to its own effort since it needs a non-rectangular grid).

Nested under specs/GH13652/ (per the specs/APP-4319/<slug>/ chain precedent).
…13726

Issue warpdotdev#13652 (bulk raw-HTML-subset request) was closed in favor of
per-feature issues; warpdotdev#13726 is the dedicated raw HTML <table> follow-up.
Moves specs/GH13652/tables/ to specs/GH13726/ (flat product.md/tech.md,
matching the prevailing per-issue GH<number>/ layout) and updates issue
references throughout, while keeping the historical "split out of warpdotdev#13652"
framing and the existing preceding-spec pointers.

No scope change: simple tables + <br>-in-cell remain in scope, colspan/
rowspan remains an explicit non-goal. Cross-references the new dedicated
<br> issue (warpdotdev#13732) and the repo's own test_unsupported_html_types
(crates/markdown_parser/src/html_parser_tests.rs), and notes that GFM
pipe-tables already work behind FeatureFlag::MarkdownTables and are
unaffected by this spec.
Fix three underspecified areas Oz flagged on PR warpdotdev#13661: (1) the spec
deferred colspan/rowspan while the PR claims to close warpdotdev#13726, which
cites spans as a motivating requirement — reframe as delivering the
un-spanned subset and flag the "Closes" wording as a maintainer call;
(2) alignment was ambiguous when per-cell align attributes disagree
within a column of the per-column TableAlignment model — header cell
wins, then first specifying body cell, else left; (3) header-row
extraction was undefined for multiple thead rows or stray th rows —
first thead row (or first th-majority row) wins, other header-like
rows demote to plain data rows rather than being dropped or merged.
… gaps (GH13726)

Round-2 Oz findings on PR warpdotdev#13661:

1. Non-goals section now names warpdotdev#13953 as the colspan/rowspan owner with
   explicit acceptance criteria for closing warpdotdev#13726 — the split was
   previously bound only in a PR comment and the Summary's "Issue
   linkage" prose, neither of which a reviewer scanning Non-goals would
   see. tech.md's Risks section is updated to match (was still framing
   the linkage as an open maintainer decision after product.md resolved
   it).

2. The block detector's opening-tag grammar now explicitly tolerates
   attributes/whitespace (`<table class="data">`), aligned with
   specs/GH13721/tech.md's parse_html_image attribute-scanner style —
   previously the detector text and the attribute-ignoring invariant
   (10) made incompatible implicit assumptions about what the detector
   matches.

3. Specifies the `<br>` vs `&lt;br&gt;` escape rule for table cells,
   including why the ambiguity GH13732 has to resolve via parser
   ordering doesn't apply here (DOM-based parse_phrasing_content
   decodes entities and recognizes elements at separate tokenization
   stages, so they can't collide). Also corrects a wrong code citation:
   the existing `"br" => LineBreak` arm is a top-level block match, not
   part of parse_phrasing_content, so cell-level <br> requires new code,
   not reuse.

No cargo — docs only.
product.md invariant 9 deferred to "the tech spec's chosen convention"
for how <table></table> renders, but tech.md never stated one — a
dangling forward-reference caught during the round-2 sweep. Resolves
it by reusing the existing FormattedTable::normalize_shape function
(already this spec's mechanism for ragged-row normalization, invariant
6) rather than inventing a new empty-table rule: normalize_shape's
`column_count == 0 → 1` guard means an empty table always yields one
column with an empty header cell and zero rows, never zero columns or
"nothing" (there's no code path in normalize_shape that produces
either). Also resolves invariant 9's "dropped or padded" ambiguity for
an empty <tr> to "padded," consistent with invariant 2's rule against
silently discarding authored rows.

No cargo — docs only.
…ed item (GH13726)

Oz flagged that the item-1 serialization rule makes round-trip
correctness depend on a parser path recognizing <br> in the internal/
GFM cell formats, while the proposed reader changes (item 2) only
cover the HTML/DOM cell reader — leaving the dependency on warpdotdev#13732's
standalone <br> work unstated.

Verified against PR warpdotdev#13870's actual (Oz-approved, merge-pending) diff:
it adds <br> recognition only at the GFM/paragraph inline tokenizer
level (parse_inline_token_br in markdown_parser.rs) and patches only
the two plain-text-flattening serializers (to_plain_text's
inline_to_text, and inline_to_markdown). It does not touch
html_parser.rs, from_internal_format/to_internal_format, or
parse_table_cell at all.

So the dependency is real but narrower than "defer <br>-in-cell to
warpdotdev#13732": only the to_plain_text GFM-export encode side is inherited
from PR warpdotdev#13870 (its inline_to_text patch already replaces any
embedded \n with <br>, not GFM-specific). The tab-separated internal
round-trip (to_internal_format/from_internal_format) and
parse_table_cell remain this spec's own work, never touched by warpdotdev#13870.
Documented the split explicitly in item 1, added a merge-order risk
note, and adjusted the round-trip test-plan rows to cite which
direction is inherited vs. own-scope.
@cla-bot cla-bot Bot added the cla-signed label Jul 24, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jul 24, 2026
@fbartho
fbartho marked this pull request as ready for review July 24, 2026 18:07
@warp-for-oss

warp-for-oss Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

@fbartho

I'm starting a first review of this spec-only pull request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @kevinyang372.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds product and technical specs for rendering block-level raw HTML <table> markup through the existing Markdown table model and render path, including authored <br> line breaks inside cells while explicitly deferring colspan/rowspan to follow-up work.

Concerns

No blocking completeness, feasibility, or issue-alignment concerns were identified. The spec covers goals/non-goals, deterministic malformed-input behavior, feature gating, model/serialization changes, dependencies on related <br> work, and validation coverage. Two clarifications would make the implementation handoff tighter: make the recommended cell-model choice binding in the spec text, and clarify the link/navigation trust boundary for inline content parsed from raw HTML table cells.

Security

  • Clarify whether raw HTML anchors inside table cells are supported through the existing link resolver or filtered, because the current non-goal says no navigation from table markup while the behavior section says links render inside cells.

Verdict

Found: 0 critical, 0 important, 2 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/GH13726/tech.md Resolved
Comment thread specs/GH13726/product.md Resolved
@warp-for-oss
warp-for-oss Bot requested a review from kevinyang372 July 24, 2026 18:12
fbartho added 2 commits July 24, 2026 12:10
Make the cell-model decision a single implementable contract (a cell is a
list of lines, Vec<FormattedTextInline>) instead of leaving Option A/B open,
so serializers, tests, and offset-map handling depend on one shape rather
than a deferred choice. Record the rejected sentinel-fragment alternative so
it is not silently reopened. Sweep tech.md for every dependent statement
(to_plain_text line-join vs inherited per-fragment escaping, the ≥2-lines
test assertion, the internal-format encode/decode join/split pair, and the
risks note) and align them to the bound contract.
The non-goal said no navigation from table markup while behavior invariant 3
said links render in cells. Resolve in the direction the spec's security
posture implies and the code confirms: an <a href> in a cell is navigable
through the viewer's existing link resolver (href captured by
update_with_attributes -> Hyperlink::Url -> table_cell_links, the same path
GFM table cells use), with no new navigation path or trust boundary; scripts,
event-handler attributes, and any non-<a href> navigation vector stay out of
scope. State link behavior once in invariant 3 and reference it from the
non-goal and the invariant 10 carve-out so the three agree exactly.
@fbartho

fbartho commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

@fbartho

I'm re-reviewing this spec-only pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @kevinyang372.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This spec adds product and technical coverage for rendering block-level raw-HTML <table> markup in the Markdown viewer by mapping supported table structure into the existing FormattedTable render path, while explicitly scoping <br>-in-cell support into this slice and deferring true colspan/rowspan support to a follow-up.

Concerns

No blocking completeness, clarity, feasibility, issue-alignment, internal-consistency, or design-level security concerns were found. The spec clearly defines the supported subset, degraded behavior for spans, feature gating, model changes, parser work, security boundaries for links/attributes, and targeted validation.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@kevinyang372
kevinyang372 requested review from bnavetta and removed request for kevinyang372 July 28, 2026 22:37
@kevinyang372

Copy link
Copy Markdown
Member

Hey @bnavetta -- I am handing this over to you for review since you have the most context here. But lmk if you want me to review instead!

@fbartho

fbartho commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@bnavetta This PR is still waiting for review. (Just trying to avoid the stale-bot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown viewer: support raw HTML <table> tags

2 participants