Open mbideau opened 2 years ago
Hi can you tell me which version of Formiko and which vesion of docutils you have?
pip3 list | grep -E 'formiko|docutils'
Sure, sorry I didn't include this information from the start.
Formiko is from the debian package of bullseye: 1.3.0-2 (package web page) And same for the Python 3 docutils (package is named python3-docutils): 0.16+dfsg-4 (package web page)
I also tried with formiko install from pip3 :
❯ pip3 list | grep -E 'formiko|docutils'
docutils 0.14
docutils-html5-writer 1.0.3
docutils-tinyhtmlwriter 1.3.0
formiko 1.4.3
And it yield almost the same error
Library Error
Sorry about that. This seems to be not supported functionality in dependent library Reader or Writer
Traceback (most recent call last):
File "/home/michael/.local/lib/python3.7/site-packages/formiko/renderer.py", line 371, in render_output
html = publish_string(**kwargs).decode('utf-8')
File "/usr/lib/python3/dist-packages/docutils/core.py", line 416, in publish_string
enable_exit_status=enable_exit_status)
File "/usr/lib/python3/dist-packages/docutils/core.py", line 664, in publish_programmatically
output = pub.publish(enable_exit_status=enable_exit_status)
File "/usr/lib/python3/dist-packages/docutils/core.py", line 219, in publish
output = self.writer.write(self.document, self.destination)
File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 80, in write
self.translate()
File "/usr/lib/python3/dist-packages/docutils/writers/_html_base.py", line 71, in translate
self.document.walkabout(visitor)
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
[Previous line repeated 4 more times]
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 166, in walkabout
visitor.dispatch_visit(self)
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1882, in dispatch_visit
return method(node)
File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1907, in unknown_visit
% (self.__class__, node.__class__.__name__))
NotImplementedError: visiting unknown node type: pending_xref
Other parameters :
The error seems to happen also with empty URL.
Thanks in advance for digging into it :pray:
TL;DR: For those coming to the issue: Add an anchor to the link as workaound.
I can reproduce this bug as well. I'm also on Debian 11. Formiko is at 1.3.0 with Debian revision -2 (1.3.0-2) I additionally tried python3-docutils 0.17.1+dfsg-1 from Debian/experimental, so the current installed dependencies are:
ii gir1.2-gtksource-3.0 3.24.11-2
ii gir1.2-gtkspell3-3.0 3.0.10-1
ii gir1.2-webkit2-4.0 2.32.3-1
ii librsvg2-common 2.50.3+dfsg-1
ii python3 3.9.2-3
ii python3-docutils 0.17.1+dfsg-1
ii python3-gi 3.38.0-2
ii python3-recommonmark 0.6.0+ds-1
An additional observation:
For me, the backtrace appears regardless whether the target file exists or not; adding an anchor text (#x
) to the link makes the backtrace disappear. Here's a doc I used to test for this report: The offending lines are commented out below.
# issue 35 test
## link to existing b.md in same directory.
<!-- [bad link](b.md) ---> backtrace
[good link](b.md#x) -- no backtrace
## link to dir/c.md (exiting)
<!-- [bad link](dir/c.md) --> backtrace
[good link](dit/c.md#x) -- no backtrace
## link to nonexisting in same dir
<!-- [bad link](nothere.md) --> backtrace
[good link](dit/nothere.md#x) -- no backtrace
Might be unrelated; formiko spits out on the console when loading the test document, (as shown above, with all bad links commented out):
/usr/lib/python3/dist-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document
warn("Container node skipped: type={0}".format(mdnode.t))
However, this might be a red herring. Update: Above message is printed to console also when I open formiko with an empty document and add one character. So very likely unrelated.
Many kudos for formiko! Its is a very helpful tool :)
Thank you very much for great report. It seems that there is problem in recommonmark library. At this moment, this problem is solved with replacing markdown library which Formiko use. I was plan update Formiko to new 1.4.3 release version to debian testing, but this error is still here.
For a few time, please use formiko from this repository, from master branch. I try to release new 1.5.0 version out as soon as possible.
(FWIW, I made a local package of recommonmark 0.7.1 -- issue still triggers in that version. However, upstream of recommonmark deprecated the usage of this library, so I guess hopes that this will be fixed are slim...)
If you need a sponsor in Debian, ping me (tobi (at) debian.org). I'm usually not doing python packages, but for this I'll make an exception :)
Try this mardown content example :
That produce the following error in the preview pane :
If I preprend the link href with an "http://" or a "#" the exception disappear.
I think this is very problematic to not be able to use reference to other document in the same folder/tree.
PS: thank you very much for this software that is working really fine for me except for this bug :pray: