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
{{ message }}
Repository navigation
Some elements turning into None in html output with md_in_html #1049
Note that the text content of the second <div> is empty. Presumably, Element.text is None rather than an empty string as it should be. We should probably just address this in the serializer to avoid None in any output.
@waylan I'm not sure what you mean in regards to the serializer.
My thinking was that there could be any number of other situations in which the text of an Element is None. We should never render that as None. However, I have since looked at the serializer and see that every call to write(text) is nested within a if text check, so the serializer already accounts for this.
It would seem that the issue is isolated to parsing the content of an Element as Markdown, which your fix addresses. So nevermind.
Activity
facelessuser commentedon Oct 21, 2020
Yup, looks like another bug in the new HTML parser, unfortunately. Looks like we need a
Nonecheck somewhere before inserting some text content.facelessuser commentedon Oct 21, 2020
I think I may have a fix.
waylan commentedon Oct 21, 2020
Here is a simpler case:
Note that the text content of the second
<div>is empty. Presumably,Element.textisNonerather than an empty string as it should be. We should probably just address this in the serializer to avoidNonein any output.waylan commentedon Oct 21, 2020
@facelessuser if you have a fix, go for it. Although we should probably do something with the serializer as well.
facelessuser commentedon Oct 21, 2020
@waylan I'm not sure what you mean in regards to the serializer.
Ensure when tag text is None that it is converted to empty string
facelessuser commentedon Oct 21, 2020
I've created pull #1050. We can discuss additional changes there if more than what I'm doing needs to be addressed.
waylan commentedon Oct 21, 2020
My thinking was that there could be any number of other situations in which the
textof anElementisNone. We should never render that asNone. However, I have since looked at the serializer and see that every call towrite(text)is nested within aif textcheck, so the serializer already accounts for this.It would seem that the issue is isolated to parsing the content of an Element as Markdown, which your fix addresses. So nevermind.
Ensure when tag text is None that it is converted to empty string