LilSpazJoekp / docstrfmt

A formatter for reStructuredText
MIT License
23 stars 15 forks source link

doctest blocks are unknown #97

Open ddeepwell opened 1 month ago

ddeepwell commented 1 month ago

Using doctests in the documentation breaks the docstrfmt linter.

When the linter runs on an rst file that includes

>>> import math
>>> math.sqrt(4)
2.0

the following error is printed: ValueError: Unknown node type doctest_block at File "/path/to/documentation.rst", line 6

It appears that the doctest extension is not handled.

mayrholu commented 1 month ago

Also code-blocks are not known.

Example:

.. code-block:: python

    >>> import module_xy
    >>> x = module_xy.function_xy(...)
    >>>

Causes: SyntaxError: invalid syntax:

LilSpazJoekp commented 1 month ago

I'll look into test blocks but code blocks that is intended and not meant to be used with >>>.