speced / bikeshed

:bike: A preprocessor for anyone writing specifications that converts source files into actual specs.
https://speced.github.io/bikeshed
Creative Commons Zero v1.0 Universal
1.08k stars 199 forks source link

Support <pre class=cddl> #2072

Open foolip opened 3 years ago

foolip commented 3 years ago

Over in https://github.com/w3c/webdriver-bidi/issues/101 we'd like an index of the CDDL snippets in https://w3c.github.io/webdriver-bidi/, similar to what we have for Web IDL.

Also nice would be syntax highlighting for CDDL.

foolip commented 3 years ago

If we have this, we should then file an issue on https://github.com/w3c/webref to extract the CDDL and perhaps publish a @webref/cddl package to NPM.

nschonni commented 3 years ago

Since the syntax highlighting comes from https://pygments.org/, that part probably needs a request there for that part

foolip commented 3 years ago

It looks like there's already some support: https://pygments.org/languages/

tabatkins commented 3 years ago

Yeah, per https://pygments.org/docs/lexers/#lexer-for-the-concise-data-definition-language-cddl-a-notational highlight=cddl will give you syntax highlighting.

I can see a feature letting you specify elements that should be collected into an index, so you can get your cddl stuff all together at the bottom of your spec as well.

foolip commented 3 years ago

Indeed, an index is what we're hoping for. And maybe splitting that by "local" and "remote" definitions.

cc @christian-bromann who has worked a bit on this in the WebDriver BiDi spec.

christian-bromann commented 3 years ago

I have implemented a CDDL parser that currently can build an AST based on some CDDL source code. I plan to add some CDDL validation and eventually autogenerate some client code. It seems that most of the bikeshed code is written in Python so not sure if the cddl package can be useful here. Not sure if I have the time to implement the same in Python but happy to advise someone who would take this up.