Skip to content

Instantly share code, notes, and snippets.

@CourteousCoder
Created May 31, 2025 09:11
Show Gist options
  • Save CourteousCoder/450e23de1792350efe570868f7a1193d to your computer and use it in GitHub Desktop.
Save CourteousCoder/450e23de1792350efe570868f7a1193d to your computer and use it in GitHub Desktop.
Demo syntax highlighting on Github
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
"packages": [],
"shell": {
"init_hook": [
/* Here we have some JSONC comments
* We this file has a .jsonc extension which github seems to recognize as JSON without issue.
*/
// Here's a single-line comment
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
// -*- mode: jsonc -*-
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
"packages": [],
"shell": {
"init_hook": [
/* Here we have some JSONC comments
* We this file has a .json extension BUT, it also includes a "mode" comment onthe first line
* as specified in the JSONC spec
* https://jsonc.org/#file-extensions.
*/
// Here's a single-line comment
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
"packages": [],
"shell": {
"init_hook": [
" ########### This is an example of a plain-json devbox.json without jsonc-style comments ########"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
"packages": [],
"shell": {
"init_hook": [
/* Here we have some JSONC comments
* This file has a plain JSON extension. Your IDE might not recognize it as JSONC and give you errors.
*/
// Here's a single-line comment
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
@CourteousCoder
Copy link
Author

This is specifically for helping find a solution to jetify-com/devbox#2602

TLDR: Insert this line at the head of your devbox.json file:

// -*- mode: jsonc -*-

Source:

Web archive of source:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment