Repository navigation
Exclude CDDL blocks in the whole Bikeshed CDDL index section - #2166
Merged
Merged
Conversation
tidoust
approved these changes
Sep 18, 2026
tidoust
left a comment
Member
There was a problem hiding this comment.
Oh, indeed. I had missed that last year when Bikeshed started to support CDDL blocks. Bikeshed prefers to keep things flat where ReSpec relies on sectioning...
Thanks for the pull request! Looks good to me.
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.
Problem
extract-cddl.mjsintends to skip the "CDDL Index" appendix that Bikeshed generates, but the exclusion is implemented asclosest('#cddl-index'). Bikeshed emits<h2 id="cddl-index">followed by sibling<h3>and<pre class="cddl">elements, so the generated blocks are never descendants of the element carrying the ID and the exclusion never matches anything.As a result, any Bikeshed spec with a populated CDDL index gets its definitions extracted twice: once from the source blocks and once from the index. When the spec defines CDDL modules, the index blocks carry no
data-cddl-module, so they also leak into every per-module extract. Specs that only reference modules defined elsewhere get an empty index from Bikeshed and are unaffected.Solution
extract-cddl.mjsexcludes everypre.cddlin the#cddl-indexsection, which runs from that heading to the next heading of the same or higher level in document order. This handles<section>wrapping and the generated per-module<h3>subsections.getCodeElements()gains an additiveexcludeFilterpredicate, called on the live element before cloning, since section membership cannot be tested on the cleaned clones it returns.excludeSelectorskeeps its ancestor semantics.