erwinmatijsen / django-markdownify

Markdown template filter for Django
MIT License
120 stars 24 forks source link

add {% markdownify %} {% endmarkdownify %} templatetags #45

Closed nerdoc closed 6 months ago

nerdoc commented 10 months ago

in many situations |markdownify is usable. But when it comes to more complex situations, the filter is not enough. If I want to call something else instead of rendering a variable, you can't use it:

This works:
{{ my_var | markdownify }}

This doesn't:
{% custom_templatetag request.user | markdownify %}

Sure, this isn't correct template syntax.

What would work (alongside {% blocktranslate %}):

{% markdownify %}
  {% custom_templatetag request.user %}
{% endmarkdownify %}

It would be relaively easy to implement that, you could reuse the filter internally.