Skip to content

pygmentify rendering <pre> and <code> tags when used on template variable in django #3

@orekchi

Description

@orekchi

Beginner here... sorry if it is a dumb question.

I have bits of code stored in a class property in models of django. When I try to call and render it in a HTML template, it works but it also renders additional tags at the beginning and end of the code:

{% pygmentify %}
<pre class="python">
{{article.code_example | safe }}
</pre>
{% endpygmentify %}

will output:
<p>print('hello world')</p>

How can I avoid this behaviour?

Thanks,

R

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions