Skip to content

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

Open

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

Activity

  1. added
    enhancement
    on Jul 14, 2026
  2. warp-for-oss commented on Jul 14, 2026

    @warp-for-oss
    Contributor

    @fbartho

    Here's what I found while triaging this issue:

    This looks like a valid Markdown Viewer feature gap. The provided test case is enough to route the request; no additional reporter details are needed for initial triage.

    Maintainer details

    I concluded that feature request for Markdown Viewer to honor block-level align on raw HTML <p>/<div> blocks; current parsing/rendering paths do not preserve paragraph or div alignment..

    Triage summary

    This is a well-scoped Markdown Viewer enhancement request. The requested behavior is to preserve align="left|center|right" on raw HTML <p> and <div> blocks and render the contained content with the corresponding horizontal alignment.

    Reproducibility

    High. The issue includes a minimal Markdown fixture, and code inspection shows the current parser/rendering pipeline does not carry block-level alignment for paragraphs or divs.

    Likely implementation area

    • crates/markdown_parser/src/markdown_parser.rs parses Markdown lines and currently has no block-level raw HTML support for <p> or <div align=...>.
    • crates/markdown_parser/src/html_parser.rs unwraps div via TOP_LEVEL_ELEMENT_TAGS_TO_SKIP and parses p through the generic fallback without reading align.
    • crates/markdown_parser/src/lib.rs defines FormattedTextStyles and table alignment, but no paragraph/div alignment metadata.
    • crates/editor/src/content/text.rs defines BufferBlockStyle; only table blocks carry alignment today.
    • crates/editor/src/render/model/mod.rs applies alignment offsets for table cells only.

    Duplicate check

    No duplicate label recommended. The closest related issues are #13652, a broad recently closed raw-HTML subset request that this issue intentionally splits out from, and #13721, a sibling request for <img> attributes. Neither provides two existing exact duplicate reports for block-level <p>/<div> alignment.

    Follow-up

    No reporter follow-up is needed for initial routing.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  3. added
    area:editor-notebooks
    repro:high
    triaged
    on Jul 14, 2026
  4. added
    ready-to-spec
    on Jul 17, 2026
  5. warp-for-oss commented on Jul 17, 2026

    @warp-for-oss
    Contributor

    This issue has been labeled ready-to-spec and is open for contributions in the form of a product or technical spec. If you'd like to draft one, feel free to open a pull request with the spec under specs/. You can also comment @oz-agent on this issue to have the bot draft the spec automatically.

  6. removed their assignment
    on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:editor-notebooksenhancementready-to-specrepro:hightriagedwarp:auto-triage-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions