Update.
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
<span class="section-title">API Reference</span>
|
||||
<ul>
|
||||
<li><a href="index.html">Overview</a></li>
|
||||
<li><a href="string.html">String</a></li>
|
||||
<li><a href="number.html">Num</a></li>
|
||||
<li><a href="http.html">http</a></li>
|
||||
<li><a href="websocket.html">websocket</a></li>
|
||||
<li><a href="tls.html">tls</a></li>
|
||||
@@ -58,6 +60,7 @@
|
||||
<li><a href="datetime.html">datetime</a></li>
|
||||
<li><a href="timer.html">timer</a></li>
|
||||
<li><a href="io.html">io</a></li>
|
||||
<li><a href="pathlib.html">pathlib</a></li>
|
||||
<li><a href="scheduler.html">scheduler</a></li>
|
||||
<li><a href="math.html">math</a></li>
|
||||
</ul>
|
||||
@@ -119,6 +122,7 @@
|
||||
<li><a href="#tests">Tests</a></li>
|
||||
<li><a href="#macros">Macros</a></li>
|
||||
<li><a href="#template-inheritance">Template Inheritance</a></li>
|
||||
<li><a href="#markdown-tags">Markdown Tags</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#filters-reference">Filters Reference</a></li>
|
||||
@@ -357,6 +361,34 @@ var template = env.getTemplate("page.html") // Loads ./templates/page.html</cod
|
||||
This long text will be truncated to 50 characters...
|
||||
{% endfilter %}</code></pre>
|
||||
|
||||
<h3 id="markdown-tags">Markdown Tags</h3>
|
||||
|
||||
<p>Convert between Markdown and HTML within templates using block tags:</p>
|
||||
|
||||
<h4>markdowntohtml</h4>
|
||||
<p>Converts Markdown content to HTML:</p>
|
||||
<pre><code>{% markdowntohtml %}
|
||||
# Heading
|
||||
This is **bold** text.
|
||||
{% endmarkdowntohtml %}</code></pre>
|
||||
|
||||
<p>Variables are resolved before conversion:</p>
|
||||
<pre><code>{% markdowntohtml %}
|
||||
# {{ title }}
|
||||
{{ description }}
|
||||
{% endmarkdowntohtml %}</code></pre>
|
||||
|
||||
<h4>markdownfromhtml</h4>
|
||||
<p>Converts HTML content back to Markdown:</p>
|
||||
<pre><code>{% markdownfromhtml %}
|
||||
<h1>Heading</h1>
|
||||
<p>This is <strong>bold</strong> text.</p>
|
||||
{% endmarkdownfromhtml %}</code></pre>
|
||||
|
||||
<p>Corresponding filters are also available for inline use:</p>
|
||||
<pre><code>{{ markdown_text|markdown }}
|
||||
{{ html_content|markdownfromhtml }}</code></pre>
|
||||
|
||||
<h3 id="comments">Comments</h3>
|
||||
|
||||
<p>Comments are not included in the output:</p>
|
||||
@@ -527,6 +559,16 @@ var template = env.getTemplate("page.html") // Loads ./templates/page.html</cod
|
||||
<td>URL-encode string</td>
|
||||
<td><code>{{ "hello world"|urlencode }}</code> → hello+world</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>markdown</code></td>
|
||||
<td>Convert Markdown to HTML</td>
|
||||
<td><code>{{ md_text|markdown }}</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>markdownfromhtml</code></td>
|
||||
<td>Convert HTML to Markdown</td>
|
||||
<td><code>{{ html_content|markdownfromhtml }}</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>List/Collection Filters</h3>
|
||||
|
||||
Reference in New Issue
Block a user