Question

I'm having a problem here: i'm building out a simple blog, and I'm using markdown, pygments and django to do so.

My content is in markdown and I wish to code-highlight it. It works fine, except markdown, is not respecting the indentation of python code.

Here's a screenshot

borked indent

And here's a screenshot of the content in django admin:

borked indent 2

Also, the code for rendering in the template:

            <div class="row">
                <div class="span12 vertical-spacer">
                    {{ object.body|markdown:"safe,codehilite"|render_inlines|safe }}
                </div>
            </div>
Était-ce utile?

La solution

I had this problem ages ago when trying to use the Mingus blog app, which uses Markdown and pygments. The issue appears to stem from the use of the render_inlines filter, although I'm not entirely sure why. I wasn't using that particular functionality, so I removed it from the template.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top