ChrisPenner / slick

Static site generator built on Shake configured in Haskell
BSD 3-Clause "New" or "Revised" License
204 stars 24 forks source link

Render Markdown in metadata fields #9

Closed AJChapman closed 4 years ago

AJChapman commented 4 years ago

This allows you to put Markdown in your metadata fields. The markdown will be rendered to HTML like the post's content is.

My use case is that I had a teaser metadata item on my posts, and I wanted to have a link in one of my teasers, but the link was being stripped from it. It turns out that Pandoc does automatically render Markdown in metadata fields, but Slick's flattenMeta was erasing this, and only keeping the plain text.

This could be a breaking change because along the way I added a PandocWriter argument to makePandocReader and makePandocReader', which are both exported from the module, though they aren't used anywhere else in Slick.

ChrisPenner commented 4 years ago

Hey there! This seems like a good thing to add in some shape or form, just have a few thoughts about how to do it.

The implementation provided doesn't really make it clear what the PandocWriter is used for; I can see people wondering "Why does makePandocReader require a PandocWriter?"

Also the fact that this will be a breaking change is maybe not great. Perhaps we should instead introduce a makePandocReaderWithMetaWriter or something similar. BTW is there a PandocWriter which when provided with behave the same as the current behaviour?

AJChapman commented 4 years ago

Ok, I've made the suggested changes:

AJChapman commented 4 years ago

@ChrisPenner what do you think, any further changes needed?

ChrisPenner commented 4 years ago

Looks great! So sorry it took me so long to get around to this 😓 ; really appreciate this addition! 😄

ChrisPenner commented 4 years ago

Shipped in v.1.0.1.0 👍 http://hackage.haskell.org/package/slick