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
Formatting an empty directive seems broken. For example formatting this
```{graphviz} ../figs/undo-simple.dot
```
leads to this:
Traceback (most recent call last):
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/bin/mdformat", line 8, in <module>
sys.exit(run())
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/__main__.py", line 8, in run
exit_code = mdformat._cli.run(sys.argv[1:])
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/_cli.py", line 74, in run
formatted_str = mdformat.text(
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/_api.py", line 37, in text
rendering = mdit.render(md)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/markdown_it/main.py", line 275, in render
return self.renderer.render(self.parse(src, env), self.options, env)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/__init__.py", line 57, in render
return self.render_tree(tree, options, env, finalize=finalize)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/__init__.py", line 91, in render_tree
text = tree.render(render_context)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/_tree.py", line 11, in render
text = renderer(self, context)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/_context.py", line 50, in render_children
return separator.join(out for out in render_outputs if out)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/_context.py", line 50, in <genexpr>
return separator.join(out for out in render_outputs if out)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/_context.py", line 49, in <genexpr>
render_outputs = (child.render(context) for child in node.children)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat/renderer/_tree.py", line 11, in render
text = renderer(self, context)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat_myst/_directives.py", line 64, in fence
code_block = format_directive_content(code_block)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat_myst/_directives.py", line 75, in format_directive_content
parse_result = parse_opts_and_content(raw_content)
File "/home/pierre/.cache/pypoetry/virtualenvs/mercurial-jupyterbook-MIlaqlFz-py3.10/lib/python3.10/site-packages/mdformat_myst/_directives.py", line 104, in parse_opts_and_content
line = lines.pop(0)
IndexError: pop from empty list
Describe the bug
Formatting an empty directive seems broken. For example formatting this
leads to this:
Reproduce the bug
Format a file with an empty directive...
List your environment
The text was updated successfully, but these errors were encountered: