← Back to Pull requests

fix: preserve lexer state when re-lexing quoted list continuations #4290

Closed
unknown closed this pull request without merging on Nov 30, 2026 16:55 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 13:34 UTC
Author

Marked version: 18.2.0 - 18.3.0

Markdown flavor: CommonMark|GitHub Flavored Markdown

Description

  • Fixes #4288
  • When a blockquote inside a list item follows a text token and has a lazy continuation line, _Tokenizer.blockquote calls this.lexer.blockTokens(currentText, tokens, true) (which restores state.lastToken to the outer list item's text token) and then calls this.list(newText) / this.blockquote(newText) directly. Seeing the stale outer text token as lastToken, this.list(newText) returned undefined for ordered lists starting above 1 (or 0 / empty items), throwing TypeError: Cannot read properties of undefined (reading 'raw'). this.list(newText) could also leave state.top = true, affecting a following indented sibling line in a tight list item.

    This saves outerLastToken in _Tokenizer.blockquote, sets state.lastToken = tokens.at(-2) (and inBlockquote = true) before re-lexing continuation lines, and restores top, inBlockquote, and lastToken afterward.

    Demo links (- a\n > 2. b\nc, {"gfm":true}):

  • 18.3.0 (crash)

  • 18.1.3 (expected)

  • CommonMark reference
  • Contributor

  • Test(s) exist to ensure functionality and minimize regression (added test/specs/new/blockquote_list_lazy_in_list_item.{md,html}); or,

  • no tests required for this PR.

  • If submitting new feature, it has been documented in the appropriate places.
  • Committer

    In most cases, this should be a different person than the contributor.

  • CI is green (no forced merge required).

  • Squash and Merge PR following conventional commit guidelines.
  • Diff: 256 lines (+192 / -64) across 3 files Reviewer: UziTech Review duration: 4520m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 256 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4290"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.1% (MEDIUM) · Higher = larger blast radius
    39.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.4% · Safe to merge
    15.4%