bikeshed icon indicating copy to clipboard operation
bikeshed copied to clipboard

Support <pre class=cddl>

Open foolip opened this issue 3 years ago • 6 comments

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 avatar Jun 01 '21 15:06 foolip

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.

foolip avatar Jun 01 '21 15:06 foolip

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

nschonni avatar Jun 01 '21 17:06 nschonni

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

foolip avatar Jun 01 '21 19:06 foolip

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.

tabatkins avatar Jun 01 '21 20:06 tabatkins

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.

foolip avatar Jun 01 '21 21:06 foolip

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.

christian-bromann avatar Jun 01 '21 21:06 christian-bromann