Skip to content

codehilite extension double escapes HTML #725

Closed
@kkinder

Description

@kkinder

Here's an example:

import markdown

example_content = """# Test 
  
    >>> print('hi') 
    hi 

The above is valid MarkDown."""

output = markdown.markdown(example_content, extensions=['markdown.extensions.codehilite'])
print(output)

As you can see, my example file includes a Markdown example with > characters. Unfortunately, with Codehilite enabled, it produces doubly-escaped content. Here's the output of that script:

<h1>Test</h1>
<div class="codehilite"><pre><span></span>&amp;gt;&amp;gt;&amp;gt; print(&#39;hi&#39;) 
hi
</pre></div>


<p>The above is valid MarkDown.</p>

See those &amp;&gt; parts? That means your HTML output includes the > characters escaped twice. It should be just &gt;&gt;&gt;, not &amp;gt;&amp;gt;&amp;gt;.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions