spanezz / staticsite

Static site generator
GNU General Public License v3.0
46 stars 7 forks source link

please add a markdown filter for jinja2 templates #7

Closed DonKult closed 7 years ago

DonKult commented 7 years ago

Hi (again),

"third time's the charm", so instead of bugs I will ask for a feature this time: I think it would be handy if you could have

{% filter markdown %}
*This* is an [example](http://example.org)
{% endfilter %}

in a jinja2 template as that makes it e.g. a lot easier to convert an md page to a j2 page (or back) later on.

It shouldn't be too hard™, a proof-of-concept from a complete python-newbie: https://github.com/DonKult/staticsite/commit/fcbcbaacb39341580658f1f22446adf97e122d9d

spanezz commented 7 years ago

Your proof of concept implementation looks good, I simplified it slightly by exporting the markdown renderer from Site, and I added a test case for it. Does it work for you?

DonKult commented 7 years ago

(All three:) Works fine for me in a quick test – thanks a lot for the quick responses!

Nitpick: No documentation, you might want to mention the markdown filter in doc/templates.md.

spanezz commented 7 years ago

Good point: added.