Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upDoctests are interpreted by the HTML template #63
Comments
This comment has been minimized.
This comment has been minimized.
peterjc
commented
Sep 8, 2017
|
I would retitle this slightly, but can confirm that pdoc does not nicely render docstests in docstrings. Example: from __future__ import print_function
def double(x):
"""Return double the input value.
>>> double(5)
10
>>> double(1.25)
2.5
"""
return x * 2
if __name__ == "__main__":
for v in [0.1, 3, 123]:
print("Doubling %r gives %r" % (v, double(v)))Then
Gives: ...
<section id="section-items">
<h2 class="section-title" id="header-functions">Functions</h2>
<div class="item">
<div class="name def" id="example.double">
<p>def <span class="ident">double</span>(</p><p>x)</p>
</div>
<div class="desc"><p>Return double the input value.</p>
<blockquote>
<blockquote>
<blockquote>
<p>double(5)
10
double(1.25)
2.5</p>
</blockquote>
</blockquote>
</blockquote></div>
<div class="source_cont">
... |
This comment has been minimized.
This comment has been minimized.
peterjc
commented
Sep 8, 2017
|
This seems to be a limitation of the markdown rendering engine - which makes sense after all, If pdoc supported reStructuredText as input, that does include support for |
peterjc
referenced this issue
Sep 8, 2017
Closed
Add --docformat argument for reStructuredText or plaintext input #137
This comment has been minimized.
This comment has been minimized.
|
Please see #153 for a unified discussion ticket about docstring flavors. |
cortesi
closed this
Jun 3, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

mikael-s commentedAug 26, 2015
When producing the output in HTML mode, doctests are simply interpreted as if they were part of markdown syntax and are replaced by (three) blockquotes.
For instance if you have the following code in a
test.pyfile:Launching
pdocon that file withpdoc --html test.pywill produce a HTML file where the docstring is replaced by the following code:Therefore the
>>>are removed and the line return is ignored which makes the doctests hardly readable.