pycco-docs / pycco

Literate-style documentation generator.

Home Page:https://pycco-docs.github.io/pycco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recognize doctests as code?

mrocklin opened this issue · comments

http://stackoverflow.com/questions/27788586/have-pycco-recognize-doctests-as-code

Is there any way to have Pycco recognize doctests as code and render them appropriately?

E.g. the docstring of the following function

def fib(i):
    """ Fibonacci number

    >>> fib(10)
    55
    """
    if i < 2:
        return i
    else:
        return fib(i-1) + fib(i-2)

Renders In Pycco like the following

Fibonacci number

           fib(10) 5

Clearly the >>> was interpretted as indentation and code highlighting did not take effect. This seems like a common use case. is there a plugin somewhere that I'm missing?