Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

syntax highlighting for code block #1378

Closed

Conversation

stc1988
Copy link
Contributor

@stc1988 stc1988 commented Jul 24, 2024

In my translation work, I found that some code blocks do not have syntax highlighting set. I believe that setting syntax highlighting will make the document easier to read and will also help to notice mistakes in the code blocks.

Therefore, there might be some parts where corrections were missed, but I made corrections as much as possible.

@phoddie
Copy link
Collaborator

phoddie commented Jul 24, 2024

This is really great – thank you!

There are a couple of issues with the original JSON.

  1. A few of them use /* comments like this */ to provide instructions. Standard JSON has no comments so these are a syntax error. But, the comments are useful so maybe they should stay as-is?
  2. The XS JSON parser used to permit a trailing comma ({"foo": 1,}) but no longer does because it is non-standard. Some of the examples use this. Should we fix these while we are making these improvements?

@stc1988
Copy link
Contributor Author

stc1988 commented Jul 24, 2024

Thank you for confirming. In the scope of this pull request, we fixed the following changes:

  • remove identifiers from JSON with comments.
  • remove trailing comma

@phoddie
Copy link
Collaborator

phoddie commented Jul 25, 2024

remove identifiers from JSON with comments

That's a good solution. (I vaguely remember that there is a "JSON with Comments" variant in use in some ecosystems. Perhaps in the future that will be a valid identifier for GitHub markdown.)

remove trailing comma

Perfect.

Thank you! We'll get this merged.

@mkellner
Copy link
Collaborator

I have merged this. It will be available in the next code-drop.

@stc1988
Copy link
Contributor Author

stc1988 commented Sep 10, 2024

That's a good solution. (I vaguely remember that there is a "JSON with Comments" variant in use in some ecosystems. > > > Perhaps in the future that will be a valid identifier for GitHub markdown.)

I recently remembered this comment, and on GitHub, if you use the jsonc identifier, it will display correctly even with comments like the one below.

  • jsonc
"include": [
	/* other includes here */
	"$(MODULES)/drivers/destm32s/manifest.json",
],
  • json
"include": [
	/* other includes here */
	"$(MODULES)/drivers/destm32s/manifest.json",
],

@phoddie
Copy link
Collaborator

phoddie commented Sep 10, 2024

Thanks for remembering this! I've updated the markdown to use "jsonc" where appropriate. That should be available shortly.

mkellner pushed a commit that referenced this pull request Sep 13, 2024
@stc1988 stc1988 deleted the feature/doc_syntax_highlight branch September 21, 2024 15:44
cmidgley pushed a commit to Intellisplash/moddable that referenced this pull request Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants