fix(edge): nested lists and attribute > leaks in markdown negotiation - #732
fix(edge): nested lists and attribute > leaks in markdown negotiation#732Anshumancanrock wants to merge 2 commits into
Conversation
Signed-off-by: anshumancanrock <anshu.1239.as@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Anshumancanrock The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for project-hami ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 42 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Markdown negotiation converter now protects ChangesMarkdown negotiation parsing
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant HTMLContent
participant AttributeProtection
participant MarkdownConverter
participant ListConverter
participant MarkdownDocument
HTMLContent->>AttributeProtection: Protect quoted `>` characters
AttributeProtection->>MarkdownConverter: Pass protected HTML
MarkdownConverter->>ListConverter: Convert nested list structures
ListConverter->>MarkdownDocument: Return formatted Markdown lists
MarkdownConverter->>MarkdownDocument: Restore protected attribute characters
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@netlify/edge-functions/markdown-negotiation.js`:
- Line 321: Update the HTML processing flow around the `<main>` extraction to
protect html before scanning the title, description, and main tags, preventing
`>` inside attributes from ending the match early. Keep protected characters
encoded throughout intermediate scans and restore them only in the final
Markdown result, then add a regression test covering a `<main>` attribute
containing `>`.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ddc641bb-232b-4649-8f80-22dbac295851
📒 Files selected for processing (2)
netlify/edge-functions/markdown-negotiation.jstest/markdown-negotiation.test.mjs
Signed-off-by: anshumancanrock <anshu.1239.as@gmail.com>
f9b46fe to
b37b444
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes the two follow-ups from #688.
Nested lists were getting flattened because
<li>.*?</li>closed at the first nested</li>, so sub-items got promoted and parent steps renumbered. Walkul/ol/liby depth instead, and unwrap<p>before list conversion so Docusaurus-style items don't come out as1.\n\ntext.Quoted
>in attributes was leaking into the body (title="a > b"→b">…) because tag scans use[^>]*. Mask those before the scans, restore after.Also keep leading indent when collapsing spaces, otherwise nested list markers get wiped.
Which issue(s) this PR fixes:
Fixes #731
Checklist:
npm run lintandnpm run format:checkpassnpm run buildsucceeds for bothenandzhgit commit -s)Summary by CodeRabbit
Bug Fixes
>characters inside quoted HTML attributes from being misinterpreted during conversion.Tests