You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use jupyter-nbconvert to convert Jupyter notebooks into markdown and embed them as examples into the pdoc documentation. This is why empty codeblocks may appear in our markdown, since empty Jupyter input cells are converted into empty code blocks... With pdoc-13.0.1 this worked flawlessly but seemed to got broken by any of the changes towards pdoc-13.1.0 (I suspect in the course of #525).
Steps to reproduce the behavior:
add empty code block to markdown docs
run pdoc
Traceback (most recent call last):
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/render_helpers.py", line 177, in to_html
return pdoc.markdown2.markdown( # type: ignore
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 175, in markdown
use_file_vars=use_file_vars, cli=cli).convert(text)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 360, in convert
text = self._do_fenced_code_blocks(text)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 2098, in _do_fenced_code_blocks
return self._fenced_code_block_re.sub(self._fenced_code_block_sub, text)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 2094, in _fenced_code_block_sub
return self._code_block_sub(match, is_fenced_code_block=True)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 1994, in _code_block_sub
return self._code_block_with_lexer_sub(codeblock, leading_indent, lexer, is_fenced_code_block)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 2043, in _code_block_with_lexer_sub
_, codeblock = self._uniform_outdent(codeblock, max_outdent=leading_indent)
File "/home/martin/.local/lib/python3.10/site-packages/pdoc/markdown2/__init__.py", line 2621, in _uniform_outdent
outdent = min(i for i in whitespace if i is not None)
ValueError: min() arg is an empty sequence
at the top of the definition of _uniform_outdent in pdoc/markdown2/__init__.py. The result looks good to me, though I'm not familiar with the pdoc codebase and don't know whether this might break other stuff....
The text was updated successfully, but these errors were encountered:
Problem Description
Short: pdoc fails for empty markdown codeblocks.
We use
jupyter-nbconvert
to convert Jupyter notebooks into markdown and embed them as examples into the pdoc documentation. This is why empty codeblocks may appear in our markdown, since empty Jupyter input cells are converted into empty code blocks... Withpdoc-13.0.1
this worked flawlessly but seemed to got broken by any of the changes towardspdoc-13.1.0
(I suspect in the course of #525).Steps to reproduce the behavior:
System Information
Fix
I was able to fix it by adding a
at the top of the definition of
_uniform_outdent
inpdoc/markdown2/__init__.py
. The result looks good to me, though I'm not familiar with the pdoc codebase and don't know whether this might break other stuff....The text was updated successfully, but these errors were encountered: