Issues when using code-block and the caption option
- Dominant language
- Python
- Stars
- 224
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
When I use a caption for my code-blocks, I get this error:
```
(ERROR/3) Error in "code-block" directive:
unknown option: "caption"
```
Here's a test run:
```shell
$ cat test.rst
Example
=======
Just a code-block:
.. code-block:: bash
:caption: example.bash
echo "Hello, world."
$ rstcheck test.rst
Success! No issues detected.
$ restview test.rst
Listening on http://localhost:26871/
test.rst:5: (ERROR/3) Error in "code-block" directive:
unknown option: "caption".
.. code-block:: bash
:caption: example.bash
echo "Hello, world."
127.0.0.1 - - [22/Jun/2026 04:35:33] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [22/Jun/2026 04:35:33] "GET /favicon.ico HTTP/1.1" 200 -
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with the shown test.rst example and the restview command, then inspect how restview parses or renders the reStructuredText code-block directive. Done means the caption option is accepted without the reported error and the example remains usable in the viewer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100