Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (29 sloc) 1.165 kB
{% extends "example_base.html" %}
{% block content %}
<p>(back to the <a href="{{ url('examples.home') }}">main page</a>)</p>
<p>An example showing how to use Bleach library to do user input sanitization.</p>
<p>For more information, check out the <a href="">
Bleach README</a>.</p>
<p>Enter some possibly harmful text here, hit send, and see what Bleach does
with it.</p>
<form id="bleachform" method="post" action="">
{{ csrf() }}
<textarea name="bleachme">{{ bleachme if bleachme else '' }}</textarea>
<p>(Allowed tags: <code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code>)</p>
<button type="submit">Bleach!</button>
{% if bleached %}
<section id="bleached">
<p>Bleached, this became:</p>
<p>{{ bleached }}</p>
{% endif %}
<p>Some things to try out:</p>
<ul id="bleachable">
<li><code>an &lt;script&gt;evil()&lt;/script&gt; example</code></li>
<li><code>Hello &lt;strong&gt;world&lt;/strong&gt;!</code></li>
<li><code>Check out &lt;a href=""&gt;;/a&gt;</code></li>
<li><code>Unbalanced &lt;em&gt;tag</code></li>
{% endblock %}
Jump to Line
Something went wrong with that request. Please try again.