{% extends "example_base.html" %}

{% block content %}
<h1>Bleach</h1>
<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="https://github.com/jsocol/bleach/">
  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>
</form>

{% if bleached %}
<section id="bleached">
  <p>Bleached, this became:</p>
  <p>{{ bleached }}</p>
</section>
{% 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="http://mozilla.org"&gt;mozilla.org&lt;/a&gt;</code></li>
  <li><code>Unbalanced &lt;em&gt;tag</code></li>
</ul>
{% endblock %}
