Skip to content

id(web): inline HTML (<sub>/<sup>/<u>/…) is backslash-escaped on save — tags become literal text #943

Closed

Description

@dezren39

Problem

In the id web editor, any inline HTML in a markdown file other than <img> / <a><img></a> is destroyed on save: the tags come back backslash-escaped as literal text.

Verified probe on main a2eef6f7 (standalone crate compiling the verbatim pkgs/id/src/web/markdown.rs codec from main; full log in the goal's hidden_files probe-2026-10-25-2312/probe2.log):

  • Input: water is H<sub>2</sub>O and x<sup>2</sup>
    • markdown_to_prosemirror produces plain text nodes "<sub>", "2", "</sub>", …
    • Save (prosemirror_to_markdown) emits: water is H\<sub\>2\</sub\>O and x\<sup\>2\</sup\>
    • The rendered document now literally shows \<sub\> instead of subscript markup.
  • Input: some <u>underlined</u> text → save emits some \<u\>underlined\</u\> text.

Root cause

pkgs/id/src/web/markdown.rs:354 — the NodeValue::HtmlInline arm of convert_node special-cases only img/linked-img tags; every other inline HTML tag falls through to text_node_with_marks(html, active_marks), turning the tag into a plain text node. On save, comrak's CommonMark renderer escapes the </> of text nodes, so the tag can never come back as HTML. Note commonmark_options() (markdown.rs:67) already sets render.unsafe = true for the sized-image HTML forms, so raw inline HTML is not rejected by policy elsewhere in this codec.

Why it matters

<sub>, <sup>, <u>, <kbd>, <mark>, <details> etc. are common in notes and technical docs. Opening such a file in the web editor and saving any unrelated edit silently corrupts every inline HTML tag in the file — the same silent-save-corruption class as #872/#873/#880/#881/#882.

Acceptance criteria

Suggested direction

Carry non-img HtmlInline content through the PM doc in a form the save direction can emit back as a comrak HtmlInline node (instead of a Text node), mirroring how sized images already round-trip via NodeValue::HtmlInline in json_to_ast (markdown.rs:~1027). The editor (TS) side may need a matching node/mark handling note — flag it in the PR if the PM representation changes.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Oct 26, 2026
  2. developing-today commented on Oct 26, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job
    • Session / ID: new-issue-creator run, 2026-10-25 23:15 CDT (America/Chicago)
    • Found via: filed this run
    • Task: HtmlInline arm (markdown.rs:354) turns non-img inline HTML into plain text nodes, so save escapes the tags (<sub> → \<sub\>). Verified this run with a standalone crate compiling the verbatim codec from main a2eef6f: H<sub>2</sub>O and <u>underlined</u> both round-trip to backslash-escaped literal text (log: goal hidden_files probe-2026-10-25-2312/probe2.log). Queued for the code pilot queue (triage packet — fix needs a representation choice).
    • Expectation: effort/m — done looks like inline HTML round-tripping unescaped (or a named benign-tag whitelist), with markdown.rs unit tests.
    • Links: n/a yet (queue packet enqueued this run)
  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 26, 2026
  5. 27 remaining items

  6. added
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 26, 2026
  7. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. dezren39 commented on Oct 26, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions