thanethomson / statik

Multi-purpose static web site generator aimed at developers.
https://getstatik.com
MIT License
258 stars 30 forks source link

How to run pandoc? #55

Open ghost opened 6 years ago

ghost commented 6 years ago

Can I run pypandoc for rendering markdown in html templates? How?

thanethomson commented 6 years ago

Do you mean that you'd prefer to use pypandoc for conversion of Markdown files to HTML prior to including into your templates? Different Markdown engines aren't supported at the moment, unfortunately, but one could perhaps hack something together using a custom template tag. Right now Statik just uses the Python-Markdown library.

ghost commented 6 years ago

Do you mean that you'd prefer to use pypandoc for conversion of Markdown files to HTML prior to including into your templates? Yes

So put it in the wishlist

epatters commented 6 years ago

I agree that an option to use pypandoc would be a very useful feature. Among other things, pandoc's support for citations and bibliographies seems to be far superior to anything in the Python-Markdown ecosystem.

I thought I'd try to implement your suggested workaround using a custom template tag or filter, but isn't it a problem that all Content fields are automatically processed by Python-Markdown? One solution involving less development effort than integrating pandoc would be to allow disabling the builtin Markdown support so that Content fields could be processed by a custom filter.

thanethomson commented 6 years ago

Good idea @epatters - the best approach would be to make the Content field processing modular. This way one could also potentially support other content formats apart from Markdown too. I'll look into doing this ASAP, along with implementing pypandoc support.

epatters commented 6 years ago

Thanks, @thanethomson! Good point about other content formats: I'm sure there are folks in the Python community who'd want to use ReST.

epatters commented 6 years ago

@thanethomson, do you have a concrete plan for refactoring the processing of the Content field? If it's not too involved, I might take a stab at implementing this feature myself.