Skip to content

docs(specs): markdown viewer align attribute blocks (GH13735) - #13906

Closed
fbartho wants to merge 6 commits into
warpdotdev:masterfrom
fbartho:fb/13735-markdown-align-blocks-spec
Closed

fbartho wants to merge 6 commits into
warpdotdev:masterfrom
fbartho:fb/13735-markdown-align-blocks-spec

Conversation

@fbartho

@fbartho fbartho commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #13735
Closes #13735 (Aside: I'm confused why a Spec is marked as closing a ticket?, but Oz wants this line)

What

Spec (product.md + tech.md, per CONTRIBUTING's spec-first workflow for feature requests) for honoring the align attribute on raw-HTML <p>/<div> blocks in the Markdown viewer (center/right/left).

Part of #13735 — the focused align-blocks issue split out of #13652 per maintainer guidance there. Sibling raw-HTML issues: #13721, #13725, #13726, #13732, #13733, #13734, #13736.

Why

GitHub renders align on <p>/<div> (it's the classic way to center images and captions in READMEs), so documents that rely on it silently lose their layout in Warp. The spec proposes modeling aligned regions as paired buffer markers with a SumTree dimension — following the ordered-list precedent maintainers pointed to in the #13345 review — so alignment composes with the inner blocks' own styles; rendering is a GUI paint concern, with the TUI surface's disposition stated explicitly.

fbartho added 3 commits July 14, 2026 14:44
…w precedent (GH13735)

Model block alignment as start/end BufferText markers plus a SumTree
dimension (ordered-list precedent), not a FormattedTextLine::AlignedBlock
wrapper. The wrapper collapses into a BufferBlockStyle when lowered into
the editor content model, which violates bnavetta's warpdotdev#13345 constraint that
only one BufferBlockStyle is active per character (aligned + code block
can't compose). Demote the wrapper to a considered-and-rejected alternative.

Also: add TUI surface disposition (best-effort within terminal width,
left-aligned fallback) as an explicit scope decision; mark warpui_core::Align
as a GUI-only paint strategy rather than the content model; fix the feature-
gating path to crates/editor/src/content/buffer.rs:850-855; rewrite the Risks
blast radius honestly for the marker design (bounded BufferText match sites)
versus the rejected wrapper (20 files matching FormattedTextLine, incl. the
non-obvious ipynb_parser and warp_tui); cite bnavetta's canonical round-trip
ruling on invariant 6.
@cla-bot cla-bot Bot added the cla-signed label Jul 17, 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 17, 2026
@fbartho
fbartho marked this pull request as ready for review July 17, 2026 20:32
@warp-for-oss

warp-for-oss Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@fbartho

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-spec when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

warp-for-oss[bot]
warp-for-oss Bot previously requested changes Jul 17, 2026

@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.

@fbartho

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-spec when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@fbartho

fbartho commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 17, 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 completed the review and no human review was requested for this pull request.

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 defines product and technical requirements for honoring align and style="text-align: ..." on raw-HTML <p>/<div> blocks in the Markdown viewer.

Concerns

  • The central parser-to-buffer boundary is underspecified: the spec rejects a FormattedTextLine wrapper but still relies on parser-emitted alignment boundary signals without defining their representation.
  • The TUI disposition depends on reading buffer/SumTree alignment markers, but the spec states the current TUI renderer consumes FormattedTextLine directly, so alignment has no defined path to that surface.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

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/GH13735/align/tech.md Resolved
Comment thread specs/GH13735/align/tech.md Resolved
Specify the concrete parser-to-buffer contract left open in the align spec:
region boundaries ride the FormattedTextLine stream as two content-less
variants (AlignRegionStart(BlockAlignment)/AlignRegionEnd) that the core.rs
edit lowering loop translates into the paired top-level BufferText align
markers, mirroring the ordered-list precedent end to end. Boundary lines stay
orthogonal to BufferBlockStyle, preserving the composition constraint.

Resolve the TUI inconsistency: because boundaries are in the FormattedTextLine
stream, the TUI reads them directly from the exhaustive match it already
consumes, with no buffer/SumTree involvement. Correct the blast-radius note to
own the added FormattedTextLine arms honestly.
@fbartho

fbartho commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 18, 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 completed the review and no human review was requested for this pull request.

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 proposes product and technical guidance for honoring align / style="text-align" on raw-HTML <p> and <div> blocks in the Markdown viewer, with a buffer marker model and GUI/TUI rendering dispositions.

Concerns

  • The tech spec's block detector requires own-line <p align> opening and closing tags, which conflicts with the product spec's required single-line <p align="center">…</p> caption behavior.
  • Feature gating is only described for the editor buffer parse path, but the spec also requires the TUI to consume the same new parser boundary variants directly; the flag behavior needs to be defined for both surfaces.
  • The added style="text-align" scope would benefit from a precise parsing subset so implementers handle common whitespace/case/declaration forms consistently.

Verdict

Found: 0 critical, 2 important, 1 suggestions

Request changes

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/GH13735/align/tech.md Resolved
Comment thread specs/GH13735/align/tech.md Resolved
Comment thread specs/GH13735/align/product.md Resolved
Specify the single-line <p align> detection path and its literal
fallback for mixed same-line text; gate the feature at the parser
crate (mirroring the MarkdownTables bool-threading mechanism through
parse_markdown_impl) so GUI and TUI share one gate; define the
text-align style micro-grammar precisely.
@fbartho

fbartho commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 18, 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 completed the review and no human review was requested for this pull request.

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 honoring align / style="text-align:…" on Markdown viewer <p> and <div> raw-HTML blocks. The scope is aligned with the linked issue and the spec covers product behavior, representation, render surfaces, feature gating, security, and validation.

Concerns

  • The parser feature-gating API is underspecified for the state where both GFM tables and block alignment are enabled; the current prose can be implemented as mutually exclusive public entry points.
  • The detector rules do not define a single HTML attribute-matching contract for both own-line and single-line cases, despite the product and security sections relying on style support, conflict handling, and ignoring unrelated attributes.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

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/GH13735/align/tech.md Resolved
Comment thread specs/GH13735/align/tech.md Resolved
…blocks (GH13735)

Address round-3 review findings on PR warpdotdev#13906.

Feature-gating: the existing parse_markdown / parse_markdown_with_gfm_tables
entry-point pair encodes a single binary choice and cannot express the state
where GFM tables and block alignment are both enabled. Replace the second-boolean
evolution with a MarkdownParseOptions { gfm_tables, block_align } struct threaded
through one shared parse_markdown_impl, thin public wrappers, and a
parse_markdown_with_options entry point; every call site populates both fields
from its FeatureFlag checks so all four combinations are well-defined.

Attribute contract: add a single Attribute-matching contract subsection that both
detector paths (own-line and single-line) cite, covering case-insensitive
attribute names, quoted/unquoted values, align= and style= extraction, the
align-vs-style conflict winner, ignoring unrelated attributes, and malformed
syntax falling back to a literal tag. Fix the stale design-question-7 reference,
tie the Security section to the contract, and add tests for quoting variants,
name case-insensitivity, unrelated attributes, and the malformed-vs-unrecognized
boundary.
@fbartho

fbartho commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 18, 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 dismissed their stale review July 18, 2026 22:11

Oz no longer requests changes for this pull request after the latest automated review.

@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 PR adds product and technical specifications for honoring align / style="text-align: ..." on raw-HTML <p> and <div> blocks in the Markdown viewer. The spec clearly defines supported values, parser behavior, content-model representation, GUI/TUI rendering disposition, feature gating, test coverage, and non-goals such as float-style wrapping.

Concerns

No blocking concerns found for completeness, clarity, feasibility, issue alignment, internal consistency, or design-level security.

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

@fbartho

fbartho commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #13961.

@fbartho fbartho closed this Jul 19, 2026
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 the align attribute on <p>/<div> blocks (center/right/left)

1 participant