5

I just came across this question and just wonder why the comments are weirdly highlighted when the code block uses <!-- language: lang-haskell -->. When not specifying any language the comments are properly grayed out. Is this a bug?

Example:

-- This is a comment and it is weirdly highlighted
fac 0 = 1
fac n = n * fac (n-1)

1 Answer 1

6

This is not a bug. The problem here is that you use <!-- language: lang-haskell --> instead of the recommended <!-- language: lang-hs --> as explained here.

I do not know what exactly lang-haskell does to your code but it does not highlight Haskell code correctly, as the do keyword in this example is not highlighted correctly and the strings are also not highlighted (when using lang-haskell):

-- This comment is just for comments sake
main = do
   name <- getLine
   print ("Hello " ++ name ++ "!")

Using lang-hs everything works fine:

-- This comment is just for comments sake
main = do
   name <- getLine
   print ("Hello " ++ name ++ "!")
1
  • 4
    Since lang-haskell does not exist, it will revert to default and let the highlighter try to interpret the language. If the post is on a question tagged with haskell, it will take the lang-hs from the tag's settings if none is specified manually.
    – animuson StaffMod
    Jul 31, 2014 at 1:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .