Fix Svelte 5 compile break on raw-HTML tables (<table><tr> without <tbody>) - #793
Merged
Conversation
Svelte 5 raises a hard compile error (node_invalid_placement) when <tr> is a direct child of <table>, which is a common raw-HTML idiom in doc markdown (e.g. hub-docs transformers-js.md) and broke downstream doc builds after #792. Wrap direct-child rows in an explicit <tbody> after mdsvex processing — the resulting DOM is identical to what browsers auto-inserted for the old output. Also silence the new element_invalid_self_closing_tag warning, which md-generated content triggers pervasively (<video ... />, <div ... />). Verified with a full local hub-docs build (268 pages, previously failing). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #792 — fixes downstream doc builds currently broken on main (e.g. hub-docs build).
Svelte 5 raises a hard compile error (
node_invalid_placement) when<tr>is a direct child of<table>: browsers auto-insert<tbody>while parsing, which breaks Svelte's hydration assumptions. Svelte 4 tolerated it. Raw-HTML tables in doc markdown commonly use exactly this idiom (hub-docs/docs/hub/transformers-js.md,bertopic.md, …).Fix
preprocessors/mdsvex/index.js: after mdsvex processing, wrap direct-child<tr>runs in an explicit<tbody>. The rendered DOM is identical to what browsers auto-inserted for the pre-Svelte-5 output, so no visual/CSS change (tbody trselectors already assumed it).svelte.config.js: silence Svelte 5's newelement_invalid_self_closing_tagwarning — md-generated content triggers it pervasively (<video ... />,<div id=... />) and it's non-actionable noise in build logs.Tables that already declare
<thead>/<tbody>are untouched (the regex only fires when<tr>directly follows<table …>).Verification
Full local hub-docs build (
doc-builder build hub docs/hub --not_python_module --html, 268 pages — the exact job that failed): passes, output contains<table><tbody><tr>. No othernode_invalid_placementpatterns surfaced across the 274 source files.🤖 Generated with Claude Code