Discussion:
[hakyll] Syntax highlighting works with pandoc, does not work in hakyll
Tinky Holloway
2016-09-28 00:41:43 UTC
Permalink
I am starting out with hakyll and am looking to have syntax highlighting in
some posts.

I'm using the site.hs that is generated with hakyll-init. I've created a
markdown syntax post that contains the lines:

``` haskell
main :: IO ()
main = putStrLn "Hello"
```

When I run this through pandoc I get:

<div class="sourceCode"><pre class="sourceCode haskell"><code class="sourceCode
haskell"><span class="ot">main ::</span> <span class="dt">IO</span> ()
main <span class="fu">=</span> putStrLn <span class="st">&quot;Hello&quot;
</span></code></pre></div>

When I look at the source generated by hakyll I only get:

<pre class="haskell"><code>main :: IO ()
main = putStrLn &quot;Hello&quot;</code></pre>

Any ideas?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sergey Bushnyak
2016-09-28 09:37:10 UTC
Permalink
You need to specify configuration

```

myPandocCompiler = pandocCompilerWith defaultHakyllReaderOptions
defaultHakyllWriterOptions { writerHtml5 = True
, writerHighlight = True , writerHighlightStyle =
pygments , writerHTMLMathMethod = MathML Nothing
, writerEmailObfuscation = NoObfuscation }

```

note highlight style parameter, and use it for conversion

```

-- Apply Pandoc compiler to convert articles from internal formatmatch
(fromGlob (path ++ "/content/articles/*.md")) $ version
"convertedPage" $ compile $ do myPandocCompiler >>=
saveSnapshot "contentM"

```

Don't forget to add css generated by pandoc.
Post by Tinky Holloway
I am starting out with hakyll and am looking to have syntax highlighting
in some posts.
I'm using the site.hs that is generated with hakyll-init. I've created a
``` haskell
main :: IO ()
main = putStrLn "Hello"
```
<div class="sourceCode"><pre class="sourceCode haskell"><code class="sourceCode
haskell"><span class="ot">main ::</span> <span class="dt">IO</span> ()
main <span class="fu">=</span> putStrLn <span class="st">&quot;Hello&quot;
</span></code></pre></div>
<pre class="haskell"><code>main :: IO ()
main = putStrLn &quot;Hello&quot;</code></pre>
Any ideas?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Take care,
Sergey Bushnyak
CTO, Kelecorix, LLC
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tinky Holloway
2016-09-29 01:26:23 UTC
Permalink
Post by Sergey Bushnyak
You need to specify configuration
Thank you Sergey.

I assume that `writerHighlightStyle` controls a tokenizer and the css file
applies an actual styling of the tokens? With my little source code example
I was unable too see any difference in output when I played around putting
different styles in here.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sergey Bushnyak
2016-09-29 14:19:57 UTC
Permalink
Yes, you need to attach proper css, pandoc can generate it for you. In
other case it will be just proper html tags, but all the colors in css.
Post by Sergey Bushnyak
You need to specify configuration
Thank you Sergey.
I assume that `writerHighlightStyle` controls a tokenizer and the css
file applies an actual styling of the tokens? With my little source code
example I was unable too see any difference in output when I played around
putting different styles in here.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Take care,
Sergey Bushnyak
CTO, Kelecorix, LLC
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...