Задать вопрос

Тел: +7 965 3737 888





Pygments Rendering Template Filter

<p>Finds all &lt;code&gt;&lt;/code&gt; blocks in a text block and replaces it with pygments-highlighted html semantics.  It tries to guess the format of the input, and it falls back to Python highlighting if it can't decide.  This is useful for highlighting code snippets on a blog, for instance.</p>

Вопрос полезен? Да0/Нет0

Ответы (2):

Ответ полезен? Да0/Нет0

Limodou: The reason why I made it this way is because I may have several different types of code snippets per text object, and I want it to try and automatically detect the language of those code snippets.

As for the CSS: You can create your own style if you like, but I have a context processor which passes in this dictionary: {'pygments_style' : HtmlFormatter().get_style_defs('.highlight')}

And you'll have to have a: from pygments.formatters import HtmlFormatter

Ответ полезен? Да0/Нет0

maybe pass a lang parameter is better. And I don't know how to deal with CSS?