Skip to content

Markdown viewer: support the align attribute on <p>/<div> blocks (center/right/left) #13735

Description

@fbartho

Pre-submit Checks

Describe the solution you'd like?

Warp's Markdown Viewer should honor the align attribute on <p> and <div> blocks — center, but also right and left. Centering is the standard way READMEs build a "hero" header (logo, title, badges), since markdown itself has no alignment syntax outside table columns. Right-alignment matters too: GitHub renders the popular pattern of anchoring a project image to the right edge of the README so it sits interleaved alongside the opening prose (via align="right" — on a wrapping block, or on the <img> itself, which the <img> sizing sibling issue covers).

Expected behavior: content inside a <div align="…"> or <p align="…"> block renders horizontally aligned per the attribute (center/right/left), with nested markdown continuing to render normally (as it already does today). (Minor fidelity note: GitHub's own rendering has a known quirk where <div align="center"> can break inline flow while <p align="center"> doesn't — matching the common-case behavior matters more than replicating that quirk.)

Is your feature request related to a problem? Please describe.

Centered header blocks at the top of a README (logo + title + badge row, often wrapped in a single <div align="center">) are extremely common, and Warp currently renders them left-aligned with the alignment attribute silently dropped.

Concretely, today in Warp's Markdown Viewer (verified on this build):

Screenshot showing alignment attributes don't appear to be applied (seem dropped)

Both the <div align="center"> and <p align="center"> blocks render left-aligned, with align ignored entirely. The nested markdown heading inside the <div> still renders as a real heading (left-aligned), and the nested <img> inside it renders as literal text — consistent with <img> being unsupported on its own (tracked separately).

Additional context

Test case:

# Centered blocks (`<p align="center">` / `<div align="center">`)

Should render: a centered heading-style line and a centered image, both horizontally centered in the pane. Currently: expect both blocks to render left-aligned as plain literal text/markdown, with the `align` attribute ignored.

<div align="center">

# Centered Title

<img src="https://placehold.co/300x150/png" alt="Centered image">

</div>

<p align="center">A centered caption line.</p>

Code pointers. As far as I can tell:

  • markdown_parser.rs has no div/p/center matching at all.
  • The paste path doesn't preserve the attribute either: div is in TOP_LEVEL_ELEMENT_TAGS_TO_SKIP (crates/markdown_parser/src/html_parser.rs, unwrapped, attributes discarded), and p falls to the generic catch-all arm — align= is never read in either case.
  • There's no alignment concept in FormattedTextStyles, so this needs a content-model addition, similar in shape to the existing TableAlignment field (used only for GFM table columns today) — that's the closest in-repo precedent for "alignment as part of the content model" I could find, alongside the generic (but currently unwired-to-markdown) crates/warpui_core/src/elements/gui/align.rs widget primitive.

Related: this splits out one tag from #13652 (bulk raw-HTML-subset request). Sibling issues from the same split: #13721 (<img> sizing), #13725 (anchor links), #13726 (raw HTML tables), #10259 (<details>/<summary> — pre-existing request), #13732 (<br>), #13733 (<kbd>), #13734 (<sub>/<sup>), #13736 (<picture>/<source>)

Operating system (OS)

macOS

How important is this feature to you?

2

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:editor-notebooksEditors, notebooks, markdown rendering, LSP, and code display.enhancementNew feature or request.ready-to-specThe issue is ready for a product and technical spec.repro:highThe report includes enough evidence that the issue appears highly reproducible.triagedIssue has received an initial automated triage pass.warp:auto-triage-review

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions