This is like [snippet 36](/snippets/36/). And it'll return css also. And it's not a filter.If the code parameter is skip, it'll test the code first, and if there is not a suiable lexer for the code, then use default python lexer to render the code. The code lanauage parameter is comes from pygments lexer alias.
How to use it
----------------
html = to_html(rest_text)
And there is a level parameter in to_html function, default is `2`, it's the sections level. And the html will be `css style + body`
How to write ReST
---------------------
Below is a example.
This is a test.
.. code::
def code(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
opt = {'display':'on'}
opt.update(options)
docnodes.Node(content, ''.join(arguments), **opt)
if opt['display'].lower() == 'on':
return [nodes.literal_block('', '\n'.join(content))]
else:
return []
.. code:: html+django
<h1 id="title">通讯录</h1>
<hr>
<div>
<table border="0" width="500">
<tr align="right">
<td>{% if has_previous %}
<a href="/address?page={{ previous }}">上一页</a>
{% endif %} {% if has_next %}
<a href="/address?page={{ next }}">下一页</a>
{% endif %}</td></tr>
</table>