Skip to content

Render helper update - #643

Merged
feruzm merged 4 commits into
developfrom
render
Feb 4, 2026
Merged

Render helper update#643
feruzm merged 4 commits into
developfrom
render

Conversation

@feruzm

@feruzmferuzm commented Feb 4, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • HTML parsing now tolerates and deduplicates duplicate attributes, reducing render failures from malformed markup.
    • Markdown-to-HTML conversion is more robust in primary and recovery paths.
  • Chores

    • Added development-time warnings to surface parsing diagnostics.
    • Package updated to patch release 2.4.14 with accompanying changelog entry.

@coderabbitai

coderabbitaiBot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Preprocess rendered HTML to remove duplicate attributes before DOM parsing; add exported removeDuplicateAttributes and apply it in createDoc and markdown-to-HTML flows. Extend lenientErrorHandler signature to accept context: unknown and make it consistently return undefined with dev-only warnings.

Changes

Cohort / File(s)Summary
Error handler
packages/render-helper/src/consts/dom-parser.const.ts
Extended lenientErrorHandler signature to include context: unknown; handler now consistently returns undefined and emits development-only console.warn messages.
Duplicate-attribute dedupe & usage
packages/render-helper/src/helper.ts, packages/render-helper/src/methods/markdown-to-html.method.ts
Added exported removeDuplicateAttributes(html: string) to strip duplicate attributes (keep first occurrence). Integrated into createDoc and both markdown-to-HTML parsing branches (initial and fallback) to clean HTML before DOM parsing/serialization.
Package metadata & changelog
packages/render-helper/package.json, packages/render-helper/CHANGELOG.md
Bumped package version to 2.4.14 and added a short changelog entry documenting the patch release.

Sequence Diagram(s)

sequenceDiagram
participant Renderer as Renderer (markdown -> HTML)
participant Dedupe as removeDuplicateAttributes
participant Parser as DOM Parser (`@xmldom/htmlparser2` / `@xmldom/xmldom`)
participant Fallback as htmlparser2 + serializer
Renderer->>Dedupe: rendered HTML
Dedupe->>Parser: cleaned HTML
Parser-->>Renderer: DOMDocument
alt parsing fails / recovery
Parser->>Fallback: attempt reparsing/serialize
Fallback->>Dedupe: serialized HTML
Dedupe->>Parser: cleaned serialized HTML
Parser-->>Renderer: final DOMDocument
end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Fixes and render-helper #617: Modifies the same packages/render-helper modules (helper.ts, markdown-to-html.method.ts) and likely overlaps with duplicate-attribute preprocessing and parsing behavior changes.

Poem

🐰 I nibble tags and toss the clones away,
One attribute stays, the rest don't stay.
I whisper warnings when parsers groan,
I tidy HTML, then hop on home. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 33.33% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check❓ InconclusiveThe title 'Render helper update' is vague and generic, using non-descriptive language that doesn't convey specific information about what was changed.Consider using a more specific title that describes the main change, such as 'Add duplicate attribute removal in HTML parser' or 'Improve HTML parsing with attribute deduplication'.
✅ Passed checks (1 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch render

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.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm
feruzm marked this pull request as draft February 4, 2026 09:39
@feruzm
feruzm marked this pull request as ready for review February 4, 2026 09:40
@feruzmferuzm added the patch Bug fixes and patches (1.0.0 → 1.0.1) label Feb 4, 2026
@feruzm
feruzm merged commit 788359d into developFeb 4, 2026
1 check passed
@feruzm
feruzm deleted the render branch February 4, 2026 09:52
This was referenced Apr 11, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patchBug fixes and patches (1.0.0 → 1.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@feruzm