Repository navigation
Description
Pre-submit Checks
- I have searched Warp feature requests and there are no duplicates
- I have searched Warp docs and my feature is not there
Describe the solution you'd like?
Warp's Markdown Viewer should render <sub> and <sup> with a vertical baseline offset (and typically reduced font size), matching the standard subscript/superscript treatment. Markdown has no native syntax for either, so raw HTML is the only way authors express them.
Expected behavior: <sub>2</sub> renders as a subscripted "2"; <sup>1</sup> renders as a superscripted "1", both visually offset from the surrounding baseline text.
Is your feature request related to a problem? Please describe.
Subscript shows up in chemical formulas and variable notation; superscript shows up constantly for footnote markers and exponents. Both are common enough in technical docs that their absence is noticeable.
Concretely, today in Warp's Markdown Viewer (verified on this build):
The raw <sub>/<sup> tags and their contents render as plain literal text at baseline, with no vertical offset.
Additional context
Test case:
# `<sub>`/`<sup>`
Should render: a chemical formula with a properly subscripted number, and a footnote-style superscript marker. Currently: expect the raw tags and their contents to render as plain literal text at baseline, with no vertical offset.
Water is H<sub>2</sub>O, and carbon dioxide is CO<sub>2</sub>.
This claim needs a citation<sup>1</sup>.
<sup>1</sup> Source: internal benchmark, 2026.Code pointers. As far as I can tell:
- Neither tag appears in
PHRASING_ELEMENT_TAGS(crates/markdown_parser/src/html_parser.rs), and the paste-path styling match arm no-ops on unknown tags — there's an adjacent TODO in that same match arm noting more phrasing styling is needed generally, so this gap looks known rather than deliberately excluded. - Neither tag has any handling in
markdown_parser.rseither. - This one looks like more than a parser tweak:
FormattedTextStyles(the shared style struct incrates/markdown_parser/src/lib.rs) has no vertical-offset/baseline-shift/font-scale field at all, so supporting<sub>/<sup>needs a small content-model addition before the parser and renderer have anything to plug into.
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>), #13735 (align on <p>/<div>), #13736 (<picture>/<source>)
Operating system (OS)
macOS
How important is this feature to you?
3
Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1
No response
Activity
warp-for-oss commentedon Jul 14, 2026
@fbartho
Here's what I found while triaging this issue:
This looks like a confirmed Markdown Viewer feature gap rather than a macOS-specific issue. The supplied markdown example should be enough for maintainers to reproduce the current baseline/literal rendering behavior.
Maintainer details
I concluded that markdown Viewer does not currently support baseline-shifted rendering for raw HTML / tags, so chemical formula and footnote/exponent notation render as literal baseline text..
Triage summary
This is a well-scoped enhancement request for Markdown Viewer raw-HTML inline rendering. The provided test case should reproduce reliably:
H<sub>2</sub>Oandcitation<sup>1</sup>currently have no supported path to become baseline-shifted, smaller inline fragments.The likely implementation gap is in the shared markdown/formatted-text pipeline rather than macOS-specific rendering.
crates/markdown_parser/src/markdown_parser.rsonly recognizes a narrow inline HTML-like special case for underline tags; other raw HTML tags are parsed as literal text.crates/markdown_parser/src/html_parser.rsalso omitssubandsupfrom the phrasing element allowlist and style mapping used by HTML parsing/paste flows. The sharedFormattedTextStylesmodel incrates/markdown_parser/src/lib.rs, plus conversions incrates/editor/src/content/text.rsand rendering incrates/warpui_core/src/elements/gui/formatted_text_element.rs, currently has no baseline-shift/font-scale field for subscript or superscript.Duplicate scan: I fetched all open issues and recent closed issues. The only close related issue is recently closed #13652, which this report explicitly splits out from; there were not two or more existing likely duplicates, so this should remain a standalone enhancement.
This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz
warp-for-oss commentedon Jul 17, 2026
This issue has been labeled
ready-to-implementand is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment@oz-agenton this issue to have the bot draft an implementation PR automatically.Thread sub/superscript through the buffer marker path for warpdotdev#…
Carry sub/superscript through the Core Text attribute round-trip for w…
Add regression test for backslash-escaped sub/sup tags (warpdotdev#13734
Strip both sub/superscript markers when clearing all text styles (war…
fix(markdown_parser): keep sub/sup wrap on inline-code export (warpdo…
fix(markdown_parser): degrade unmatched sub/sup opens to literal (war…
fix(editor): scope sub/sup unstyle broadening to strip-all mask (warp…
fix(editor): agree on nested sub/sup tie between summary and render (w…
style(markdown_parser): rustfmt the inline-code test helper (warpdotd…
fix(editor): flip sub/sup nesting tie rule to innermost-wins (warpdot…
fix(markdown_parser): bail whole span to literal on nested sub/sup (w…
fbartho commentedon Jul 19, 2026
Out of scope for the current implementation — documenting the future direction:
Browsers render nested
<sup>/<sub>cumulatively:x<sup>a<sup>b</sup></sup>raises "b"higher than "a" (a second baseline shift stacked on the first), and each level of nesting
gets progressively smaller/higher (or lower) type — matching how nested exponents or
multi-level subscripts read in math notation. Math markup like this is not uncommon in
Markdown on GitHub and elsewhere (READMEs, academic/scientific project docs, formula-heavy
issue threads), so this isn't a hypothetical edge case — it's a real gap, just not the one
this slice's fix addresses.
Current behavior (as shipped)
Any nesting of
<sub>/<sup>— same direction (<sup>inside<sup>), opposite direction(
<sub>inside<sup>or vice versa), or depth ≥ 2 — bails the entire outermost span(open tag through close tag, all contents, including nested tags) to plain literal source
text. Only a single, non-nested
<sub>or<sup>renders styled. This was a deliberateproduct ruling: two motivating cases showed that even a "reasonable" degraded rendering
(flat collapse, or an innermost-wins tie) still produces a plausible-looking but factually
wrong formula rather than an obviously broken one —
2<sup>3<sup>4</sup></sup>(meant as 2^(3^4)) would flatten to a single superscriptoffset, rendering "34" raised — reading as 2^(34), a different number.
2<sup>3<sub>4</sub></sup>(meant as 2^(3-sub-4)) under innermost-wins would render "4"at a full subscript depth measured from "2"'s own baseline, reading as (2³)₄ — again a
different, wrong expression.
Showing the whole span as source text avoids ever displaying a formula that looks valid but
isn't what the author wrote.
What browsers do
outer level's shift, rather than replacing it).
vertical-align: super/subcombined with the UA stylesheet's font-size reduction stacks under repeatednesting).
<sub>inside<sup>or vice versa) partially cancels ratherthan the inner simply overriding the outer.
Why deferred
deliberate MVP scope choice for THIS slice — it is not a claim that nested math notation
is rare or unimportant enough to ignore forever. It's the safest thing to ship now (never
wrong, sometimes plain) while the real fix (below) gets designed properly.
vertical_align(Option<VerticalAlign>—
None/Sub/Sup) is a flat tri-state throughout the buffer summary, the CoreTextattribute round-trip, and the paint path. None of these layers have a concept of nesting
depth or a stack of offsets today. Supporting compounding is a data-model change touching
every one of those layers, not a tweak to a tie-rule, and shouldn't be scoped into this
bug-fix pass.
What the buffer/style model would need
Option<VerticalAlign>with a representation that can carry a signed depth (e.g.i8, positive for superscript levels, negative for subscript levels, opposite-directionnesting partially cancelling) at each of:
TextStyle/StyleAndFont(paint input),StyledBufferRun.text_styles(render iterator output),StyleSummary(the sum-treesummary — the depth-tracking counters already present for
subscript_counter/superscript_counterare the natural basis for this, since they already count net opensminus closes), and the CoreText attribute round-trip (currently a 2-value enum encoding;
would need to carry a signed integer instead).
crates/warpui/src/platform/mac/text_layout.rsand the winit-shaperequivalent) needs a per-depth baseline-offset and font-scale formula instead of the current
single fixed offset/scale pair, and needs to verify line-height/clipping still holds at
multiple nesting levels (the original tech spec flagged single-level clipping as a spike
risk; multi-level compounds that risk further).
crates/markdown_parser/src/markdown_parser.rs,parse_vertical_align/Delimiter::vertical_align_poisoned) would need to be replaced withactual depth-tracking at parse time, rather than detecting nesting and refusing to style it.
<sub>/<sup>tagsfaithfully at the source level today (the flattening/bail is a rendering-only limitation,
not a content-model loss) — confirm this remains true once the internal representation
gains a depth field, so export doesn't regress.
Related: #13912 (the analogous depth-aware follow-up for nested
<kbd>, same rationale anddeferral shape — every inline style in the current content model is a flat boolean/tri-state,
and depth-aware nesting would be the first genuinely nesting-aware inline style in the
pipeline for either feature).
(If the line-based rendering model is ever reworked to support this kind of cumulative composition, text flowing around aligned block images likely ranks ahead of exponent towers as the first consumer of that rework.)