How to add syntax coloration in Hakyll

Posted on May 8, 2020
Tags: Hakyll

By default, this feature is not integrated into Hakyll, but a css example is present on the Github repo.

Just add this code to your stylesheet and voilĂ :

if syntax_color is True:
    print("It works !")

You can also find other styles at https://github.com/Anomareh/pygments-styles-dump, but these ones will require a little adaptation.


Edit: There is also a way to call pygmentize from hakyll: https://jip.dev/posts/the-switch-to-hakyll/