fsprojects / FsReveal

FsReveal parses markdown and F# script file and generates reveal.js slides.
http://fsprojects.github.io/FsReveal
258 stars 102 forks source link

Weird syntax highlighting #111

Open markvincze opened 7 years ago

markvincze commented 7 years ago

I encountered a strange problem with syntax highlighting: I have an almost identical code sample on two consecutive slides, both of them defines a record type, but the second one is also using the mutable keyword. And the coloring of the two samples are pretty different.

The first one: image

The second: image

Has anyone encountered something similar before? Can I simply hook in either a different syntax coloring library, or use a different theme for just the code?

Or this is completely unrelated from FsReveal, and I should ask this on the highlightJs page instead?

danyx23 commented 6 years ago

I had this too in a more drastic way with Elm code. E.g. http://danielbachler.de/goto-berlin-elm/#/0/10 and http://danielbachler.de/goto-berlin-elm/#/0/11 are Elm code with and without type annotations, one is colored and the other not. Later on there are cases where syntax highlighting failed with examples where there were type annotations present. I tried updating the highlight.js script inside the fsreveal library to a newer version and that improved the syntax highlighting but a lot of the errors are still there. I haven't had the time yet to investigate but there is definitely something weird going on. The next step should IMHO be to figure out if highlight.js alone would correctly format these snippets and if it would still do so if it is used on a static page where two code blocks are formatted in turn (to check if there is some state in highlight.js that is maybe not correctly reset between formatting calls).