Skip to content

Syntax highlighting skipped on literal_block with custom exceptions traceback #8156

@thepabloaguilar

Description

@thepabloaguilar

Describe the bug
When we have a docstring with traceback example with the last line containing something similar to lib.example.something Sphinx warning about and don't highlight that piece of code

To Reproduce
Steps to reproduce the behavior:

$ git clone git@github.com:dry-python/returns.git
$ cd returns
$ poetry install
$ cd docs
$ make html

Code example:

class IOResult:
    def unwrap(self) -> IO[_ValueType]:
        """
        Example.

        .. code:: pycon

          >>> from returns.io import IO, IOFailure, IOSuccess
          >>> assert IOSuccess(1).unwrap() == IO(1)

          >>> IOFailure(1).unwrap()
          Traceback (most recent call last):
            ...
          returns.primitives.exceptions.UnwrapFailedError

        """

If we remove the line returns.primitives.exceptions.UnwrapFailedError everything works fine, or if we change the line to Something: returns.primitives.exceptions.UnwrapFailedError

PS: I tried to change pycon to python, I got no success too!

Expected behavior

Sphinx should can highlight that code.

Your project

returns

Environment info

  • OS: Linux 5.7.9-1-MANJARO
  • Python version: 3.8.3
  • Sphinx version: 3.1.1
  • Sphinx extensions:
sphinx.ext.autodoc
sphinx.ext.doctest
sphinx.ext.todo
sphinx.ext.coverage
sphinx.ext.viewcode
sphinx.ext.autosummary
sphinx.ext.napoleon
m2r
sphinx_autodoc_typehints
sphinxcontrib.mermaid
hoverxref.extension

related issue dry-python/returns#568

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions