Phoenix Template Engine for Pandoc
A Phoenix template engine that uses pandoc to convert templates to HTML. It fully supports EEx tags as well as all input formats supported by pandoc. Pandoc runs at compile time; EEx tags are evaluated afterwards, so they output HTML.
Installation
A pinned pandoc release is downloaded and verified on first use; see
PhoenixPandoc.Installer to pin another release or use an installed pandoc.
The package can be installed by adding phoenix_pandoc to the list of dependencies in your mix.exs:
defp deps do
[
{:phoenix_pandoc, "~> 2.0"},
]
end
Configuration
To use this template engine with Phoenix, you have to configure it for each
file extension you want to use. Add lines to your config.exs similar to:
config :phoenix, :template_engines,
md: PhoenixPandoc.Engine,
rst: PhoenixPandoc.Engine
To enable live reloading for those extensions, you need to edit the patterns
that phoenix_live_reload watches. For the above example, your
config/dev.exs might look like:
config :my_app, MyAppWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
~r"lib/my_app_web/(controllers|live|components)/.*(ex|heex|md|rst)$"
]
]
Optional Markdown Configuration
Pandoc supports a number of markdown flavors. See the PhoenixPandoc module
for details on how to configure the default flavor.