-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with urls inside markdown tables #127
Comments
Hmm, I can confirm this breaks on my machine too, and with this minimal example:
I think that the fix would be somewhere here: https://github.com/ExecutableBookProject/MyST-Parser/blob/f28529919f261178ec7add8dcd61fbdb594123f1/myst_parser/docutils_renderer.py#L531 but maybe @chrisjsewell has an idea? |
Hey @martinagvilas thanks for the report. Well a little lower down: https://github.com/ExecutableBookProject/MyST-Parser/blob/f28529919f261178ec7add8dcd61fbdb594123f1/myst_parser/docutils_renderer.py#L534 This is where children of the row are added as children of the Firstly I would look at: https://github.com/ExecutableBookProject/MyST-Parser/blob/master/tests/test_renderers/fixtures/tables.md (in raw format), these are the tests defining exactly how the markdown is converted to docutils AST. We would want to add additional test(s) here to clarify the current/desired conversion. Then I would look here: https://github.com/docutils-mirror/docutils/blob/master/test/test_parsers/test_rst/test_tables.py, at the equivalent behaviour for the rST parser. As you mention, it may be that for your case the link is not being wrapped in a paragraph. Of the top of my head, it would also be good to check if this is always the case, or is it because you only have the single link in the cell, e.g. what would be the outcome for these:
|
Quick update:
and
do not work |
Indeed, inspecting the output of
shows no
as outputs in these tests expect |
What about changing this to something like this:
... to wrap the paragraph as well. I tried it and it seems to render ok. |
@martinagvilas wow thanks for prototyping that fix! Glad that you were able to orient yourself to the codebase quickly. That looks reasonable to me, but @chrisjsewell would know better than I do. Are there other places in the code where we just "wrap" an element in another element? |
Well its easy, when its such a well written code base 😆 Yeh that's pretty much it 👍 , I should be able to add it in the next day. |
Indeed - I must admit I also made a mental note that this must be a well-written codebase :-) |
It is a great codebase, I agree 🚀 I can try to submit a PR with some tests if you haven't started working on that already. I checked the glue features (amazingly awesome 😄) and it seems to be rendering fine with the changes: The plots do look smaller than here but I tried rendering the same tables without the |
This is required by docutils/sphinx, which expects inline content to be within a block level parent. For example, for URL references (as noted in #127)
We also are having this exact issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1828390. |
We're on
(from https://searchfox.org/mozilla-central/rev/d405168c4d3c0fb900a7354ae17bb34e939af996/python/sites/docs.txt#7) and I see from https://pypi.org/project/myst-parser/ that the latest is 2.0.0, so we're well behind. Thank you so much for suggesting the update, I'll see if we can get this fixed! |
Hi! I'm trying to upgrade the turing way book to the new jupyter-book beta version and found a bug when I want to link a url inside a table. I'm kind of new in the world of sphinx, commonmark and parsers, so this might be a bug I need to report to sphinx instead of here. I'm sorry if that is the case!
To give a reproducible example of the error, if I want to build jupyter-book using a single markdown file containing the following:
(rendered markdown version below)
I get the following error:
But if I link it outside the table:
[Binder](https://mybinder.org/)
there is no issue.
One possible reason for the issue, but I might be totally wrong in this: Reading the sphinx error message in context, it seems that the writer in sphinx is expecting the node parent of the reference to be a TextElement. But when I used the MyST API to manually convert these texts to docutils I get that the parent of the reference is
<entry>
, which I don't think is of text kind. In the isolated reference case (when is not inside the table), the parent node is<paragraph>
.I'm using:
cc @choldgraf
The text was updated successfully, but these errors were encountered: