← Back to Pull requests

fix: normalize line endings for inline parsing #4283

Closed
unknown closed this pull request without merging on Nov 27, 2026 18:49 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 03:39 UTC
Author

Marked version: 18.3.0 (master at 393e1dc2)

Markdown flavor: CommonMark / GitHub Flavored Markdown

Description

parseInline misses hard breaks in CRLF and CR input and leaves carriage returns in code spans. Its default lexer enters inline tokenization directly, bypassing the line-ending normalization used by block parsing.

import { parseInline } from 'marked';

parseInline('one  \r\ntwo'); // Expected: 'one<br>two'
parseInline('`one\rtwo`');   // Expected: '<code>one two</code>'

Normalize CRLF and CR at Lexer.lexInline using the existing block lexer rule. The new tests cover hard breaks, GFM breaks, and code spans with LF, CRLF, and CR.

The demo shows the expected output through its block parser. Hard break · Code span

CommonMark line endings · Code spans

Contributor

  • Regression tests added. The same nine cases had six failures on the base and all nine pass with the fix.

  • npm ci and npm test pass on Node 26.13.1 (2,053 spec tests and 285 unit tests, including build, UMD/CJS, types, and lint). npm ci, build, unit, spec, and CJS checks also pass on Node 20.20.2 and 27.0.0-alpha.0.1.1.
  • Committer

  • CI is green.

  • Squash and merge following the conventional commit guidelines.
  • Prepared with Codex assistance.

    Diff: 204 lines (+153 / -51) across 2 files Reviewer: UziTech Review duration: 2349m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 204 lines diff across 2 files
    0.36
    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%
    56%
    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.318
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4283"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 36.3% (MEDIUM) · Higher = larger blast radius
    36.3%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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.7% · Safe to merge
    15.7%