fix: parse HTML instead of XML in SvgCanvas2D.convertHtml by tbouffard ¡ Pull Request #1012 ¡ maxGraph/maxGraph
No actionable comments were generated in the recent review. đ
âšī¸ Recent review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
đ Files selected for processing (1)
packages/core/__tests__/view/canvas/SvgCanvas2D.test.ts
Walkthrough
Switches SvgCanvas2D.convertHtml to parse HTML using DOMParser('text/html'), adds unit tests for convertHtml across multiple scenarios, and updates minor JSDoc formatting and testing guidance in docs.
Changes
| Cohort / File(s) | Summary |
|---|---|
Tests packages/core/__tests__/view/canvas/SvgCanvas2D.test.ts |
Adds new test suite for SvgCanvas2D.convertHtml covering plaintext passthrough, body-tag extraction, body attributes, empty input, nested HTML preservation, and malformed HTML normalization. |
Implementation packages/core/src/view/canvas/SvgCanvas2D.ts |
convertHtml now uses DOMParser with 'text/html' (replacing XML parsing) and simplifies the document null check; JSDoc for text() reformatted only. |
Docs / Guidance CLAUDE.md |
Adds a data-driven testing example using test.each/it.each (documentation-only change). |
Estimated code review effort
đ¯ 2 (Simple) | âąī¸ ~10 minutes
Possibly related PRs
- refactor: use parseXml instead of direct call to DOMParser #991: Also modifies SvgCanvas2D.convertHtml parsing approach; directly related to parsing logic changes.
đĨ Pre-merge checks | â 1 | â 2
â Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | â ī¸ Warning | The description is incomplete. It lacks the PR Checklist section, issue reference, and does not follow the template structure required by the repository. | Complete the PR checklist, add issue reference (closes #xxxx), confirm tests are added, and follow the full template structure including Notes section if applicable. |
| Docstring Coverage | â ī¸ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
â Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | â Passed | The title clearly and concisely describes the main change: fixing HTML parsing by switching from XML parser to proper HTML parsing in SvgCanvas2D.convertHtml. |
âī¸ Tip: You can configure your own custom pre-merge checks in the settings.
Tip
Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.
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 @coderabbitai help to get the list of available commands and usage tips.