Skip to content

[Theme] More complete example of JSON file for syntax highlighting #5066

@noelma

Description

@noelma

Description

More complete example of JSON file for syntax highlighting

Use case/motivation

The example JSON file for syntax highlighting is the one provided by the json.org site.

This example only contains strings, object and array.

{
    "glossary": {
        "title": "example glossary",
        "GlossDiv": {
            "title": "S",
            "GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
                    "SortAs": "SGML",
                    "GlossTerm": "Standard Generalized Markup Language",
                    "Acronym": "SGML",
                    "Abbrev": "ISO 8879:1986",
                    "GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
                        "GlossSeeAlso": [
                            "GML",
                            "XML"
                        ]
                    },
                    "GlossSee": "markup"
                }
            }
        }
    }
}

This is not enough to set syntax highlighting
Can you provide a more complete example like this:

{
    "object": {
        "array": [
            { "value": "first" },
            { "value": "second" }
        ],
        "bool_false": false,
        "bool_true": true,
        "char": "a",
        "encoding": "\uD83D\uDE10",
        'error': 'error',
        "exponential": 1E2,
        "exponent": 1e2,
        "float": 1.0,
        "integer": 1,
        "null": null,
        "regex": "/.HTML/",
        "string": "Lorem ipsum",
        "url": "http://example.com",
        "void": ""
    }
}

The syntax highlighting example is not intended to represent a real case, but only to help create themes. Real cases are never complete enough

Expected result:
Capture d’écran du 2022-12-10 10-14-04

I don't know if adding an error in the example is relevant 🤷‍♂️

Related issues

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

Metadata

Metadata

Assignees

Labels

JSONkind:featureA feature requestneeds:triageRequires attention from one of the committers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions