Consider you document a long code snippet and you want to represent repetitive values and lines in it with ellipses … (…
) and vertical ellipses ⋮ (⋮
).
Here's an example record in JSON. There are 26 kids and you don't want to show all of them.
.. code-block:: json
{
"total": 26,
"kids" [
{
"_id": 1,
"name": "Alice",
"age": 3
},
{
"_id": 2,
"name": "Becky",
"age": 3
},
...,
{
"_id": 26,
"name": "Zoe",
"age": 4
}
]
}
Human readers can still see this as a JSON snippet/code, generalize and guess the pattern between "Becky" and "Zoe" represented by the ellipsis (...).
But Sphinx returns the error because this snippet has an invalid syntax.
$ make html
...
/.../docs/source/sample.rst:3: WARNING: Could not lex literal_block as "json". Highlighting skipped.
Can I use ellipses in code-block (with syntax highlighting)? Please note the example doesn't have to be in JSON. You will see this issue in other languages such as Python too.