I am using Sphinx to document a web service. I would like to show a formatted JSON web response using the code-block directive, which Spinx does via Pygments, but JSON doesn't have a syntax highlighter in Pygments. What language do you suggest I specify instead? HTML? JavaScript?
.. code-block:: javascript
{
"name": "roger",
"score": 100
}
Data is represented in name/value pairs. Curly braces hold objects and each name is followed by ':'(colon), the name/value pairs are separated by , (comma). Square brackets hold arrays and values are separated by ,(comma).
RST stands for ReStructured Text. It is the standard markup language used for documenting python packages. Sphinx is the Python package that generates an html website from RST files, and it is what we are using to generate this site.
I am using Sphinx 1.4.2 which includes a Pygments lexer called "json". This is available out-of-the-box by default. To use:
.. code-block:: json
{
"key": "value",
"key2": "value2",
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With