💠 🐕 💠 (:diamond_shape_with_a_dot_inside:
:dog2:
:diamond_shape_with_a_dot_inside:
)
🐶
僕のこのブログのposts/*.mdは、以下のようにhtmlへ、site.hsによってコンパイルされます 👍
main :: IO ()
main = hakyll $ do
-- 前略
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
-- 後略
pandocCompiler
はhakyllによって以下のように定義されてます 😄
-- Hakyll.Web.Pandoc
pandocCompiler :: Compiler (Item String)
pandocCompiler = pandocCompilerWith defaultHakyllReaderOptions defaultHakyllWriterOptions
--pandocCompilerWith :: ReaderOptions -> WriterOptions -> Compiler (Item String)
:smile:
のような絵文字をHakyllで使うには、pandocCompilerWith
のdefaultHakyllReaderOptions
のreaderExtensions
に Text.Pandoc.Options.Extension
のExt_emoji
を追加してあげます。
pandocCompilerWithEmoji :: Compiler (Item String)
pandocCompilerWithEmoji =
let readerExtensions' = readerExtensions defaultHakyllReaderOptions
in pandocCompilerWith
defaultHakyllReaderOptions { readerExtensions = Set.insert Ext_emoji readerExtensions' }
defaultHakyllWriterOptions
main :: IO ()
main = hakyll $ do
-- 前略
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompilerWithEmoji -- !!
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
-- 後略
👍 😃
この記事はこちらから修正リクエストを送ることができます。
HakyllのCompilerでemoji(:dogs:)をコンパイルする - github
ゴミ箱ボタンの左にある、鉛筆ボタンを押してね!