Skip to content

id(web/markdown): #3740's alert-marker restore unescapes markers in blockquotes that start with a fence or HTML block — quote_has_content is never marked on the fence/HTML path #7563

Closed

Description

@dezren39

Finding

PR #3740's save-side restore_github_alert_markers only unescapes a GitHub alert marker when it is the first content of its blockquote — its own doc comment: "Markers elsewhere remain ordinary escaped text." The tracking has a hole for one first-block shape: when a blockquote's first block is a fenced code block or an HTML block, no line on that path ever marks quote_has_content, so the quote still counts as "empty" when a later paragraph begins. A standalone escaped marker line there (\[\!NOTE\] with a hard break — authored literal text, not an alert) is then unescaped and its hard-break backslash is stripped, silently rewriting authored text on save. The parse side got this right (preserve_github_alert_marker_breaks requires the first child to be a Paragraph), and the nested-quote first-block case is handled (content lines mark ancestors) — fence/HTML-first is the unhandled sibling.

Evidence

  • Source PR: Fix #1376: preserve GitHub alert blockquotes #3740 (merged, merge commit bf26382e60c00db923a57915128d382af4e109be) — "Fix id(web): GitHub alert blockquotes lose their alert on save — [!NOTE] marker is backslash-escaped into plain text #1376: preserve GitHub alert blockquotes". id(web): GitHub alert blockquotes lose their alert on save — [!NOTE] marker is backslash-escaped into plain text #1376 is CLOSED; deduped: searches for the function name / fence-first case returned no covering issue.
  • Current main 2aca793a345a88b2f11a815fc190da4df07e0ee0, pkgs/id/src/web/markdown.rs, restore_github_alert_markers at :4254:
    • The fence-interior branch, the HTML-interior branch, and the fence/HTML opening-line branches all continue without touching quote_has_content — verified by reading the function top to bottom: quote_has_content is written only in the depth-0 reset, the guard reset, and the final marker/content branch.
    • quote_is_empty is computed as !quote_has_content[..=depth].iter().any(...), so after a fence-first blockquote the later marker line still sees an "empty" quote and is unescaped (with the hard-break suffix stripped).
  • Trace (this run, on the main code): input lines > ``` , > code, > ``` , >, > \[\!NOTE\]\, > Body. — the three fence lines pass through the fence branches unmarked; the marker line then satisfies quote_is_empty and is rewritten to > [!NOTE], losing the authored escape and the hard break.
  • PR Fix #1376: preserve GitHub alert blockquotes #3740's tests pin the neighbouring cases — marker text inside a fence stays verbatim (test_alert_marker_text_inside_code_fence_is_untouched), and a nested quote as first block does not make an alert (test_nested_first_block_does_not_make_alert) — but no test has a fence or HTML block as the quote's first block followed by a literal marker line.

Why it matters

This is the same silent-rewriting class #3740 was written to eliminate, in the one first-block configuration its tests do not cover: a document that quotes a code sample and then writes a literal [!NOTE]-looking line loses the escape (and a hard break) on the first save, so the text no longer round-trips as authored.

Acceptance criteria

  • A blockquote whose first block is a fence or an HTML block counts as having content: a later standalone escaped marker line in it stays escaped, hard break intact.
  • Genuine alerts (marker as the quote's first content) still restore, and the existing Fix #1376: preserve GitHub alert blockquotes #3740 fixpoint tests still pass.
  • A regression test pins the fence-first (and ideally HTML-first) blockquote with a following literal marker line as a save fixpoint.

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
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  3. added
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 8, 2026
  4. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged
    • Verdict: work kind task/small-fix · priority/low · effort/s · kind/bug (as filed)
    • Priority why: priority/low retained from filing; brief line 5.
    • First step: In restore_github_alert_markers' tracking, mark quote_has_content for fence/HTML first blocks, mirroring the parse side's first-child rule.
    • Acceptance: An escaped marker after a fence/HTML-first block stays escaped on save A true first-content marker still restores as an alert Markdown tests green
    • Fix packet: repo-health:v1:fix:developing-today/code:issue:7563 → queue repo-health-code-pilot, task 14445 (enqueued by triage-step this run)
  5. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    agent-note: task 14445 handed off to opencode claimant (lane row 5990) by lane code-v. Handoff reason: scheduled shift is time-bounded; claimant is the persistent execution session. Issue #7563 verified OPEN with no hard-stop labels and no needs-triage (fresh gh, lane code-v 2026-11-10). Parked 1200s for the claimant.

  6. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · alert-restore fence/HTML-first hole fixed as PR #8715 — parked on review (task 14445, lane code-c)

  7. 3 remaining items

  8. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  9. added a commit that references this issue on Nov 11, 2026
  10. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — PR #8715 merged (task 14445, lane code-c)

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

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/pr-diff-reviewFiled by the pr-diff-review 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