Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support JSON With Comments #1028

Closed
connorshea opened this issue Nov 2, 2018 · 4 comments · Fixed by #1440
Closed

Support JSON With Comments #1028

connorshea opened this issue Nov 2, 2018 · 4 comments · Fixed by #1440
Labels
lexer-request A request for a lexer to be developed.

Comments

@connorshea
Copy link
Contributor

VS Code supports it, as does GitHub linguist.

A bit of JSON with comments, using the identifier json:

{ 
  // This is json
  "json": true
}

A bit of JSON with comments, using the identifier jsonc:

{ 
  // This is jsonc
  "json": true
}

Rouge doesn't recognize jsonc as a valid language.

@sormy
Copy link

sormy commented Mar 20, 2019

@jneen
Copy link
Member

jneen commented Mar 21, 2019

We could add jsonc as an alias for json_doc I suppose!

@pyrmont pyrmont added the lexer-request A request for a lexer to be developed. label Feb 16, 2020
@asbjornu
Copy link
Contributor

When the fenced code block uses the http language specifier and the Content-Type equals application/json, how do we switch from the default json lexer to the jsonc lexer for the contents in the HTTP body of the code block? Example:

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
  // It would be nice if this comment was supported
  "foo": "bar"
}
```

@jneen
Copy link
Member

jneen commented Sep 25, 2020

@asbjornu If you wouldn't mind creating a new issue next time, it'd make it easier for us to reference. I've pushed what I think addresses the above in #1592.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
lexer-request A request for a lexer to be developed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants