Open foolip opened 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.
Since the syntax highlighting comes from https://pygments.org/, that part probably needs a request there for that part
It looks like there's already some support: https://pygments.org/languages/
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.
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.
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.
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.