acoomans / flask-autodoc

Flask autodoc automatically creates an online documentation for your flask application.
MIT License
98 stars 49 forks source link

Fix autoescaping in custom template example #21

Closed lukeyeager closed 9 years ago

lukeyeager commented 9 years ago

When you use a custom template, Autodoc uses render_template(). But the default template is rendered with render_template_string() (see here). Apparently, those functions handle autoescaping differently.

Before

<p class="docstring">{{doc.docstring|urlize|nl2br}}</p>

Python2: autodoc-issue-before-python2 Python3: autodoc-issue-before-python3

After

<p class="docstring">{% autoescape false %}{{doc.docstring|urlize|nl2br}}{% endautoescape %}</p>

Python2/3: autodoc-issue-after