hakyll/web/tutorials/faq.markdown

59 lines
2.3 KiB
Markdown
Raw Normal View History

2011-06-13 16:26:04 +00:00
---
title: FAQ
author: Jasper Van der Jeugt
2011-06-13 16:26:04 +00:00
---
2011-11-23 11:36:51 +00:00
## "File name does not match module name" on Mac OS
Hakyll.hs:1:1:
File name does not match module name:
Saw: `Main'
Expected: `Hakyll'
2013-01-13 20:46:25 +00:00
Is an error encountered on Mac OS when your configuration is named `hakyll.hs`
and located on a case-insensitive filesystem. A workaround is to rename it to
something that isn't the name of the module, for example, `site.hs`.
2011-11-23 11:36:51 +00:00
2013-01-13 20:46:25 +00:00
## pandocCompiler/Hakyll/Pandoc eats my HTML!
2011-11-23 11:36:51 +00:00
Sometimes, it can seem that HTML pages are stripped of some arbitrary tags, e.g.
2013-01-13 20:46:25 +00:00
`<div>`'s. The issue here is that, when using the default `pandocCompiler`, your
2011-11-23 11:36:51 +00:00
page passes through Pandoc. Pandoc unfortunately strips away this information,
giving you the "wrong" HTML.
2013-01-13 20:46:25 +00:00
The solution is not to use `pandocCompiler`, but something simpler like
`getResourceBody`. This way, your HTML is not touched.
2011-11-23 11:36:51 +00:00
2011-06-13 16:26:04 +00:00
## Does Hakyll support syntax highlighting?
Syntax highlighting is enabled by default in Hakyll if you are using a somewhat
recent version of Pandoc (1.9 and onwards). Note that you also need to include
some CSS in order for this to work! This site, for example, uses the [default
Pandoc syntax CSS file][syntax-css].
2011-06-13 16:26:04 +00:00
To highlight a code block, you need to use Pandoc's fenced code block syntax to
set the block's language. For example, here's how you highlight Haskell code:
``` haskell
fac n = foldr (*) 1 [1..n]
```
For details, see Pandoc's user guide on [fenced code
blocks][pandoc-code-blocks] and [inline code][pandoc-inline-code].
[syntax-css]: https://github.com/jaspervdj/hakyll/blob/master/web/css/syntax.css
[pandoc-code-blocks]: http://johnmacfarlane.net/pandoc/README.html#fenced-code-blocks
[pandoc-inline-code]: http://johnmacfarlane.net/pandoc/README.html#verbatim
2011-06-13 16:26:04 +00:00
## When should I rebuild and when should I build?
2013-01-13 20:46:25 +00:00
If you execute a `./site build`, Hakyll will build your site incrementally.
However, we can not detect if you edited `site.hs`. In this case, you first want
2013-02-11 17:53:14 +00:00
to compile `site.hs` again, and then do a `./site rebuild`.
2011-06-13 16:26:04 +00:00
After rebuilding your site, all files will look as "modified" to the filesystem.
This means that when you upload your site, it will usually transfer all files --
this can generate more traffic than necessary, since it is possible that some
files were not actually modified. If you use `rsync`, you can counter this using
the `--checksum` option.