highlight text
How to use: {% load highlight %} {{ text|highlight:'word' }}
- text
- highlighting
- highlight
How to use: {% load highlight %} {{ text|highlight:'word' }}
sterm is the search term. text is the result search text. it will highlight every matched search term in search result. please define your own .yellow css class. use: {{search_result_var|highlight:search_term}}
Use this, if you want to "activate" menu items by URL. Typical usage is with CSS class 'active'.
This template tag will attempt to apply pygments syntax highlighting to anything inside {% code %} and {% endcode %} tags. You can optionally pass in the language to highlight in the form of {% code 'lang' %} - if you don't, it will first try to guess the syntax, and then fall back to Python syntax highlighting.
Replaces <code> blocks with syntax highlighted code. Use CSS to actually get the colours you want, look at pygments documentation for extracting css for various styles. This snippet has the advantage of falling back on <pre> if anything goes wrong, and attempting to guess the syntax of code, falling back on python.
Finds all ``<code></code>`` 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.
6 snippets posted so far.