Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class CDDL (RFC 8610) support to ReSpec, including parsing/highlighting of <pre class="cddl">, definition/linking behavior, inline {^ ^} references, and an optional generated CDDL index section.
Changes:
- Introduces new core modules for CDDL processing (
core/cddl) and index generation (core/cddl-index), plus associated styling. - Extends inline processing to recognize Bikeshed-style
{^type^}/{^type/key^}/{^type/"value"^}syntax and resolves these to generated CDDL definitions. - Refactors copy-to-clipboard UI into a shared
core/clipboardmodule and wires it into WebIDL (and CDDL blocks).
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/spec/core/cddl-spec.js | New test suite covering CDDL parsing, highlighting, definitions, inline refs, modules, and index behavior. |
| tests/karma.conf.base.cjs | Allows Karma to serve cddlparser files from node_modules. |
| src/styles/cddl.css.js | Adds CDDL-specific styling, including dark mode. |
| src/core/webidl-clipboard.js | Refactors WebIDL copy button to use shared clipboard helpers. |
| src/core/inlines.js | Adds parsing/HTML generation for {^ ^} CDDL inline references. |
| src/core/import-maps.js | Adds cddlparser AST/parser exports for runtime use. |
| src/core/highlight.js | Excludes pre.cddl from highlight.js processing. |
| src/core/dfn-panel.js | Adds “CDDL” marker in dfn panels to jump to CDDL declarations. |
| src/core/clipboard.js | New shared copy-button implementation + export-surviving runtime script injection. |
| src/core/cddl.js | New CDDL processing pipeline: parse, mark up, create/register dfns, resolve forward/inline refs, add headers + copy buttons. |
| src/core/cddl-index.js | New index generator that consolidates CDDL blocks into section#cddl-index. |
| profiles/w3c.js | Enables CDDL modules in the W3C profile pipeline. |
| package.json | Adds cddlparser dependency. |
| pnpm-lock.yaml | Locks cddlparser@0.6.0. |
| examples/basic.html | Demonstrates CDDL usage, inline refs, and index section in an example spec. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot, can you fix the things you found |
Implemented all four review fixes in
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot for the new review comments:
|
Fixed #4 in Unresolved inline CDDL refs now get Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Can you rebase, lint, and prettier this? |
Done in I rebased, ran prettier on the changed files, and verified lint/build ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Use textContent instead of innerHTML in resolvePendingRefs (security) - Add beforesave cleanup for data-cddl-pending attributes (export) - Add focus-visible styles for dfns, links, and copy buttons (a11y)
- Replace px/cm with em in CDDL header CSS (accessibility) - Simplify CSS custom property fallbacks (Baseline support) - Add lang="en" to basic.html - Update basic.built.html to include CDDL example
Agent-Logs-Url: https://github.com/speced/respec/sessions/b4746b49-7393-4002-8600-4fc682af39cb Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
- Register cddl.js and cddl-index.js in aom, geonovum, and dini profiles (inlines.js runs in all profiles and produces CDDL links) - Warn about unresolved data-cddl-pending refs (catches typos) - Restore removeOnSave on clipboard copy buttons to preserve existing WebIDL export behavior - Remove unreachable code path in inlineCddlMatches - Revert unrelated lang="en" changes in example files
Agent-Logs-Url: https://github.com/speced/respec/sessions/03bab1f5-5dad-45b1-be26-e08f772a577c Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
e16e76c to
947c2b2
Compare
|
@copilot can you take a look at CI and fix the issue? |
Fixed and pushed in I checked the failing workflow logs, fixed the TS lint failures ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Remove CDDL from non-W3C profiles (aom, dini, geonovum) - Fix RFC 8610 link fragment (#appendix-D, not #section-appendix.d) - Rename `header` to `heading` in cddl-index.js - Fix dark mode contrast for CDDL header (white text on dark bg) - Add cddl-block marker style in dfn-panel (matches idl-block) - Replace dfns with spans in CDDL index to avoid duplicate defs - Use `const html = String.raw` for HTML template syntax highlighting - Inline state.definitions.set() per Sid's nit - Use `dfn.id ||= id` for prose dfns - Flatten nested loop in normalizeProseDfns with single querySelectorAll - Add type annotation for NodeListOf<HTMLElement> - Verify RFC 8610 link URL in prelude keyword test
- Use `html` (String.raw) tag on all HTML template string returns in ReSpecCDDLMarker for syntax highlighting support - Use renameElement() from utils.js for dfn→span conversion in CDDL index instead of manual DOM manipulation

CDDL Support!
Example:

Summary
Adds full CDDL (RFC 8610) support to ReSpec, closing #5123.
<pre class="cddl">blocks using cddlparser<dfn>elements for CDDL types, map keys, and string values{^ ^}inline syntax for cross-referencing CDDL definitions from prose (Bikeshed-compatible)<dfn cddl-type>,<dfn cddl-key for="...">,<dfn cddl-value for="...">tstr,uint,bool, etc.) auto-linked to RFC 8610<section id="cddl-index">)clipboard.jsused by both WebIDL and CDDL)data-no-cddlattribute to skip processing on display-only blocksdata-cddl-moduleattribute for multi-module specs (like WebDriver BiDi)Bikeshed compatibility
The syntax is designed to match Bikeshed's conventions so specs can migrate between tools:
<pre class="cddl">block syntax{^type^},{^type/key^},{^type/"value"^}inline references<dfn cddl-type>,<dfn cddl-key>,<dfn cddl-value>shorthand attributescddl-type-name,cddl-key-type-key, etc.)Beyond Bikeshed
Test plan
tests/spec/core/cddl-spec.jscovering parsing, highlighting, definitions, inline syntax, prose definitions, modules, index, generics, ranges, control operators, tags, byte strings, sockets, forward references, and real-world patternspnpm lintcleanexamples/basic.htmlwith a WebDriver BiDi extension exampleCloses #5123