-
Notifications
You must be signed in to change notification settings - Fork 875
PrettifyTreeprocessor AttributeError #1261
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
Comments
Based on the information you provided, I don't understand how that results in an error. All we are doing is resigning |
Oh, I got it. I believe this has not been an issue thus far as internally we always assign a string value to the Finally, the relevant code is here for future reference. |
By default |
I was curious how the serializer handles a markdown/markdown/serializers.py Lines 160 to 168 in a2e4788
When Finally, the question remains whether the prettifier needs to take any action on an empty code block. In other words, do we want <pre><code></code></pre> or <pre><code>
</code></pre> If the former, then the suggested fix will work fine. If the latter, then we need a slightly more sophisticated fix. Checking Balemark (compare this with this) is looks like the first option is acceptable. Given the above, a PR is welcome adding |
Thanks, I'll make a PR later :) |
Thanks for your help! 👍 Minor note, this also affects non-empty blocks, i.e. blocks with children but no text, such as |
This code section near the bottom of
markdown.treeprocessors
raisesAttributeError
ifpre[0].text
isNone
.The check should be
if len(pre) and pre[0].tag == 'code' and pre[0].text is not None
orisinstance(pre[0].text, str)
, but that may be too strict.I encountered this with a custom Block/Inline processor. The band-aid fix was just to ensure these elements had text.
The text was updated successfully, but these errors were encountered: