asciidoctor / asciidoctor-reveal.js

:crystal_ball: A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
http://asciidoctor.org
Other
287 stars 189 forks source link

Highlightjs for Haskell looks bad/different in revealjs #527

Closed refaelsh closed 4 months ago

refaelsh commented 4 months ago

Here is a simple code for problem demonstration:

= Oh, this pesky state...
:data-uri:
:revealjsdir: reveal.js
:backend: revealjs
:source-highlighter: highlightjs
:highlightjs-languages: haskell, asciidoc

== Stateless example

[source, Haskell, linenums]
----
  myInts :: [Int]
  myInts = [1, 42, 1, 42, 1, 42]

  doubled :: [Int]
  doubled = map (\int -> int * 2) myInts
----

[source, haskell, linenums]
----
-- Not polymorphic list reversion.
reverselist [Int] -> [Int]
reverseList list = ...

-- Polymorphic list reversion.
reverselist [a] -> [a]
reverseList list = ...
----

Here how it looks with plain Asciidoctor: image

And here how it looks with Asciidoctor+RevealJS: image

The plain Asciidoctor highlighting looks way better. Might it be that I found an issue in Asciidoctor+RevaelJS?

refaelsh commented 4 months ago

UPDATE: I just found out by accident that if I remove the line -- Not polymorphic list reversion. from the source code block, the problem goes away. It seems to be that only when commented lines appear in a Haskell source code block, then the problems begin.

ggrossetie commented 4 months ago

As far as I remember, reveal.js is using its own plugin to do syntax highlighting. That's the reason why you can have differences between Asciidoctor using Highlight.js or Rouge and Asciidoctor reveal.js.

If you can reproduce this issue using the latest version of reveal.js you should open an issue there: https://github.com/hakimel/reveal.js

I'm closing since I don't think we should fix this issue here.

refaelsh commented 4 months ago

Oh, yes, I understand. Thank you very much for the prompt response.

If you can reproduce this issue using the latest version of reveal.js

I will try it and go open a bug there.