rstcheck / rstcheck-core

Core library behind rstcheck.
http://rstcheck-core.rtfd.io/
MIT License
4 stars 8 forks source link

[Bug]: Indented literal block "Could not find line" #81

Closed larsoner closed 12 months ago

larsoner commented 1 year ago

To Dos

Example Code (rst)

- Change the configuration defaults by running in your terminal:

  .. code-block:: console

      $ defaults write org.python.python NSAppSleepDisabled -bool YES

Relevant log output

Could not find line for literal block directive. Source: 'doc/help/faq.rst' at line None

Description

A nested/indented .. code-block:: causes problems. Unindenting it fixes them (but then doesn't render in RST nested in the bulleted list).

Operating System

macOS

Operating System Details

No response

Python Version

3.11.5

rstcheck Version

6.2.0, 1.1.1

Additional Context

No response

Cielquan commented 12 months ago

I think the underlying issue is the NodeVisotor from docutils, which is used under the hood for rst source validation. When the code block is indented the code block's node.line is None. I did not dive deeper, so I don't know the exact reason.

I reduced the message's level to warning and stated explicitly that the message itself only is a warning and may be due to an indented code block but is not an error of itself.

Cielquan commented 12 months ago

Released in 1.2.0