rstcheck / rstcheck-core

Core library behind rstcheck.
http://rstcheck-core.rtfd.io/
MIT License
4 stars 8 forks source link

[Feature]: JSONC (JSON with comments) support #92

Open ml-evs opened 8 months ago

ml-evs commented 8 months ago

To Dos

Description

We often want to annotate our JSON code blocks, e.g., in technical specifications like https://github.com/Materials-Consortia/OPTIMADE/blob/develop/optimade.rst.

We tend to do this by adding "//" comments either on their own line or as inline comments, following the "standard" produced at https://komkom.github.io/jsonc.

I think this would be straightforward to add as a jsonc language to rstcheck-core and I would be happy to do the work. Is it of interest to the rstcheck devs/community?

There should be no additional dependencies required, just a simple stripping of the comments before validating with the usual JSON validator.

We may also be able to follow-up with support for JSONLines if desired.

Operating System

Other

Operating System Details

No response

Python Version

N/A

rstcheck Version

N/A

Cielquan commented 8 months ago

Sounds good to me. JSONLines is also ok. But please make one PR per feature.

I guess both "languages" will need their own external parser. Please add them via extras like with yaml.

ml-evs commented 8 months ago

Great, thanks for the quick reply! I'll investigate JSONC and see if JSONL is worth adding at a later date.