Skip to content

Conversation

oprypin
Copy link
Contributor

@oprypin oprypin commented Nov 2, 2023

If there is an empty <pre><code></code></pre> inserted by another extension, there can be an exception. The added test case was crashing before this change:

  File "markdown/core.py", line 361, in convert
    newRoot = treeprocessor.run(root)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "markdown/extensions/codehilite.py", line 274, in run
    self.code_unescape(block[0].text),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "markdown/extensions/codehilite.py", line 260, in code_unescape
    text = text.replace("&lt;", "<")
           ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

If there is an empty `<pre><code></code></pre>` inserted by another extension, there can be an exception. The added test case was crashing before this change.
@waylan waylan merged commit f5b151a into Python-Markdown:master Nov 3, 2023
@oprypin oprypin deleted the edgehilite branch November 3, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants