Skip to content

Formatting of Exceptions in apidoc examples #2830

@seclinch

Description

@seclinch

I'm using sphinx-apidoc to generate documentation for a project. The project already uses doctest and so many of the docstrings contain code snippets that serve as both examples and test cases.

I was pleased to find that sphinx automatically formats the example code nicely, but I seem to have found one specific case in which it doesn't work for me.

In the attached example file, the first two example code snippets are correctly formatted by apidoc, the final example is not (using the alabaster theme, I get the grey box for a code snippet but no syntax highlighting).

doctestsphinxtest.txt

The difference appears to be using a user-defined exception rather than an inbuilt one. Is there a way to have an example raising a user-defined exception work correctly?

screen shot 2016-08-04 at 16 48 50

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions