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

đŸ“Ĩ Commits

Reviewing files that changed from the base of the PR and between de64192 and cde3bc8.

📒 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

đŸšĨ 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.

â¤ī¸ Share

Comment @coderabbitai help to get the list of available commands and usage tips.