{{ post.title }}
Published on {{ post.created_at|date:"F d, Y" }} {% if post.author %}by {{ post.author.get_full_name|default:post.author.username }}{% endif %}
Template Integration =================== This guide covers how to properly integrate Martor in your Django templates, both for editing (forms) and displaying (rendered markdown) content. Template Tags and Filters -------------------------- Martor provides template tags and filters for rendering markdown content: .. code-block:: html {% load martortags %} Safe Markdown Filter ~~~~~~~~~~~~~~~~~~~~ The primary filter for rendering markdown as HTML: .. code-block:: html {% load martortags %} {{ post.content|safe_markdown }} {{ article.description|safe_markdown }} The ``safe_markdown`` filter: * Converts markdown to HTML * Applies security filtering (XSS protection) * Processes Martor extensions (emoji, mentions, etc.) * Returns safe HTML that can be displayed directly Template Structure for Forms ----------------------------- Basic Form Template ~~~~~~~~~~~~~~~~~~~ .. code-block:: html {% extends "base.html" %} {% load static %} {% block title %}Create Post{% endblock %} {% block css %} {% endblock %} {% block content %}
Published on {{ post.created_at|date:"F d, Y" }} {% if post.author %}by {{ post.author.get_full_name|default:post.author.username }}{% endif %}
Price: ${{ product.price }}
SKU: {{ product.sku }}