philomena/lib/philomena_web/text_renderer.ex

13 lines
294 B
Elixir

defmodule PhilomenaWeb.TextRenderer do
alias PhilomenaWeb.MarkdownRenderer
def render_one(item, conn) do
hd(render_collection([item], conn))
end
def render_collection(items, conn) do
Enum.map(items, fn item ->
MarkdownRenderer.render(item.body, conn)
end)
end
end