Render blurbs as markdown
This commit is contained in:
parent
33a2e4ab93
commit
dc0ac71f98
10
site.moon
10
site.moon
@ -18,6 +18,8 @@ rend = "renderers.markdown"
|
||||
require(rend).cmd = "pandoc --mathjax >"
|
||||
|
||||
-- Replace the default markdown renderer with our custom renderer
|
||||
-- TODO we shouldn't remove it because it is still searched for in some places
|
||||
-- example https://github.com/leafo/sitegen/blob/ac9b7c199ed7adb32064b056a438cbaed8c71d23/sitegen/renderers/html.moon#L53
|
||||
Site.default_renderers = for v in *Site.default_renderers
|
||||
if v\find "markdown" then rend else v
|
||||
|
||||
@ -92,13 +94,15 @@ sitegen.create =>
|
||||
|
||||
html.build ->
|
||||
import section, h3, time, a from tag
|
||||
md = @site\get_renderer "renderers.markdown"
|
||||
|
||||
return for post in *posts
|
||||
{:title, :blurb, :id, publish_date: {iso, pretty}} = post.meta
|
||||
url = rootname post\url_for!
|
||||
md = post.site\get_renderer "renderers.markdown"
|
||||
blurb = md\render @, blurb if blurb
|
||||
if blurb then blurb = html.builders.raw! blurb
|
||||
|
||||
if blurb
|
||||
blurb = raw md\render @, blurb
|
||||
blurb.text = unpack [v for v in blurb.text\gmatch "<p>(.-)</p>"]
|
||||
|
||||
section {
|
||||
h3 { a { title or titleize_slug(id), href: url }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user