There is an Ext_alert
extension in pandoc
which handles alerts like this:
↪ echo "> [!WARNING]" | pandoc -t html -f gfm
<div class="warning">
<div class="title">
<p>Warning</p>
</div>
</div>
I’m trying to use it inside my hakyll
project manually:
myPandocCompiler :: Compiler (Item String)
myPandocCompiler =
pandocCompilerWithTransformM ropt wopt (pygmentsHighlight . shiftHeaders 1)
where
ropt = defaultHakyllReaderOptions { readerExtensions = enableExtension Ext_alerts pandocExtensions }
wopt = defaultHakyllWriterOptions { writerExtensions = enableExtension Ext_alerts pandocExtensions }
But it doesn’t work.
I can bypass hakyll
and use pandoc
only with the same result:
λ> ropt = defaultHakyllReaderOptions { readerExtensions = getDefaultExtensions "gfm" }
λ> wopt = defaultHakyllWriterOptions { writerExtensions = getDefaultExtensions "gfm" }
λ> readerExtensions ropt
Extensions (fromList [Ext_alerts,Ext_auto_identifiers,Ext_autolink_bare_uris,Ext_emoji,Ext_footnotes,Ext_gfm_auto_identifiers,Ext_pipe_tables,Ext_raw_html,Ext_strikeout,Ext_task_lists,Ext_tex_math_dollars,Ext_tex_math_gfm,Ext_yaml_metadata_block])
λ>
λ>
λ> runPure $ writeHtml5String wopt =<< readMarkdown ropt ("> [!WARNING]" :: Text)
Right "<blockquote>n<p>[!WARNING]</p>n</blockquote>"
What am I doing wrong?
How to readMarkdown and writeHtml5String using pandoc
, converting alerts?