Does Highlight.js fail in Haskell?

I use Highlight.json my site with a theme Monokai.css. More details:

<link rel="stylesheet" href="../../css/styles/monokai.css">
<script src="../../js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Bit, as you can see, something went wrong.

<pre>
  <code class="haskell">
    {-# OPTIONS_GHC -Wall #-}
    euclid :: Int -> Int -> Int
    euclid a b
      | a == 0    = b
      | b == 0    = a
      | a > b     = euclid (a-b) b
      | otherwise = euclid a (b-a)
  </code>
</pre>

Why is it not displayed correctly?

+4
source share
1 answer

In my DOM explorer, I see this turning into

<code class="haskell hljs">
        <span class="hljs-pragma">{-# OPTIONS_GHC -Wall #-}</span>
        euclid :: <span class="hljs-type">Int</span> -&gt; <span class="hljs-type">Int</span> -&gt; <span class="hljs-type">Int</span>
        euclid a b
          | a == <span class="hljs-number">0</span>    = b
          | b == <span class="hljs-number">0</span>    = a
          | a &gt; b     = euclid (a-b) b
          | otherwise = euclid a (b-a)

      </code>

These spans have the following rule from line 143 at http://tekkkz.com/css/style.css , which will ruin their size and placement. A disconnect that makes it look good to me.

.content span {
    float: left;
    padding-right: 50px;
}
+2
source

Source: https://habr.com/ru/post/1609077/


All Articles