twolfson / restructuredtext-lint

reStructuredText linter
The Unlicense
171 stars 20 forks source link

Support code-block and emphasize-lines #46

Closed nvtkaszpir closed 6 years ago

nvtkaszpir commented 6 years ago

Sphinx-doc code-block supports emphasize-lines, but restructuredtext-lint returns error in that case:

Example code:

.. code-block:: python
   :emphasize-lines: 3,5

   def some_function():
       interesting = False
       print 'This line is highlighted.'
       print 'This one is not...'
       print '...but this one is.'

Expected output: no error. Actual output: Error in "code-block" directive: unknown option: "emphasize-lines".

Reference: http://www.sphinx-doc.org/en/stable/markup/code.html

requirements.txt

alabaster==0.7.10
Babel==2.5.3
certifi==2018.1.18
chardet==3.0.4
doc8==0.8.0
docutils==0.14
idna==2.6
imagesize==1.0.0
Jinja2==2.10
MarkupSafe==1.0
packaging==17.1
pbr==3.1.1
Pygments==2.2.0
pyparsing==2.2.0
pytz==2018.3
requests==2.18.4
restructuredtext-lint==1.1.3
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.7.1
sphinx-rtd-theme==0.2.4
sphinxcontrib-autoyaml==0.4.1
sphinxcontrib-websupport==1.0.1
stevedore==1.28.0
typing==3.6.4
urllib3==1.22

PS: doc8 also fails on this.

twolfson commented 6 years ago

Unfortunately, we don't support Sphinx directives. Explanation and workarounds explained here:

https://github.com/twolfson/restructuredtext-lint/tree/1.1.3#sphinx

lextm commented 5 years ago

doc8 should be added as a workaround, https://pypi.org/project/doc8/