personal-1.0.0: Personal web site for Yoo Chung
CopyrightCopyright (C) 2023 Yoo Chung
LicenseAll rights reserved
Safe HaskellSafe-Inferred



Various Hakyll compilers and functions to assist use of Hakyll compilers.



haskellCompiler Source #


:: [String]

Extra flags to pass to runhaskell.

-> Compiler (Item ByteString) 

Run the Haskell code in the underlying file and use its output.

For example,

>>> let _ = compile $ haskellCompiler []

The Haskell code will be executed using runhaskell. It will run with -XGHC2021 and -XOverloadedStrings.

Extra flags can also be passed to runhaskell. For example,

>>> let _ = compile $ haskellCompiler ["-XTypeFamilies"]

This can compile both Haskell code and literate Haskell code.

Pandoc options

Pandoc reader and writer options that can be used with pandocCompilerWith.

mathReaderOptions :: ReaderOptions Source #

Reader options for properly treating math in input.

Should be used in conjunction with mathWriterOptions for proper math rendering. For example:

>>> let _ = pandocCompilerWith mathReaderOptions mathWriterOptions

mathWriterOptions :: WriterOptions Source #

Writer options for writing out math to HTML.

Should be used in conjunction with mathReaderOptions to read input that is to be rendered as math. For example:

>>> let _ = pandocCompilerWith mathReaderOptions mathWriterOptions

Pages which use math should define the include-math metadata field to ensure that the resources necessary for rendering math is included.

getTocOptionsWith :: WriterOptions -> Compiler WriterOptions Source #

Rewrite the writer options to include a table of contents if the source has a toc field in its metadata. If there is no such field, the given writer options are returned as is.

For example:

>>> let _ = getTocOptionsWith defaultHakyllWriterOptions
>>> let _ = getTocOptionsWith mathWriterOptions

Custom contexts

siteContext :: Context String Source #

Default context used for the site. Adds customizations specific to this site to "defaultContext". In particular,

  • Cleans index.html URLs into directory URLs ending with /.

Use this when compiling items for this site instead of "defaultContext".


cleanupIndexUrl :: String -> String Source #

If the given URL is local and ends with index.html, strip the latter.

For example:

>>> cleanupIndexUrl "/article/index.html"
>>> cleanupIndexUrl "/article/page.html"
>>> cleanupIndexUrl ""

URLs are cleaned up by default with "siteContext", so one will usually not call this directly.