🐛 Ignore comments/targets in component child validation#271
Merged
Conversation
Comments, hyperlink targets, and system messages are structurally inert, so they are now silently tolerated as children of the grid, card-carousel, tab-set, and tab-set-code directives, rather than emitting a confusing "All children of X should be Y" warning. Hyperlink targets inside a tab-set are additionally preserved, both when the directive rebuilds its children and when TabSetHtmlTransform restructures the tab-set for HTML output (targets are moved to the front of the rebuilt node), so that references to them still resolve. Closes #86
chrisjsewell
pushed a commit
that referenced
this pull request
Jul 12, 2026
chrisjsewell
pushed a commit
that referenced
this pull request
Jul 12, 2026
The rst/myst comment/target tests added in #271 broke the py311-no-myst tox env (not run in CI); guard the myst variants with the same skipif pattern used in test_snippets.
This was referenced Jul 12, 2026
chrisjsewell
added a commit
that referenced
this pull request
Jul 12, 2026
All global configuration is declared once on a dataclass with typed, TOML-compatible fields, per-field validators and help text (modelled on myst-parser's MdParserConfig). Flat sd_* confvals remain the public interface; modules read via a typed get_sd_config accessor; invalid values warn under design.config and fall back to defaults, with per-entry pruning for sd_custom_directives. Also guards the myst-parametrized tests from #271 so the no-myst tox env passes.
chrisjsewell
pushed a commit
that referenced
this pull request
Jul 12, 2026
Follow-up to #271, which preserved target nodes but not their anchors: - docutils PropagateTargets moves a preceding target's ids onto the tab-item container, which TabSetHtmlTransform destroys — copy the container's ids onto the rendered label so href targets exist - tab-set-code dropped targets entirely (asymmetric with tab-set) — preserve them the same way - strengthen the target test to assert a rendered node carries the id and that it appears in the built HTML (the previous assertions passed against the broken output); add a tab-set-code variant - get_started: clarify that examples may need extending myst_enable_extensions beyond the snippet shown
chrisjsewell
added a commit
that referenced
this pull request
Jul 12, 2026
Follow-up to #271: carry container-propagated target ids onto the rendered tab label, and preserve targets in tab-set-code, so anchors to targets inside tab components actually exist in HTML output. Tests now assert the rendered id in built HTML.
24 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.
Closes #86. Comments, hyperlink targets, and system messages inside
grid,card-carousel,tab-set, andtab-set-codeno longer trigger the confusing "All children of X should be Y" warnings.is_ignorable_childhelper inshared.py(comment/target/system_message), applied in all four child-validation loops; behaviour for genuinely invalid children unchanged (existing Fix ValueError crash when tab-set contains non-tab-item children #258 regression passes as-is).TabSetDirectiveandTabSetHtmlTransform), so references to a target placed before a tab-item still resolve; the HTML transform now enumerates only tab-items for the selected-index logic, so a leading target no longer shifts the default-checked tab.[design.tab].Validation:
tox -e py311(119 passed),mypy,ruff check,ruff format --check— all green; no regression files changed.