asciidoctor / asciidoctor-reveal.js

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

Custom highlight.js display errors #491

Open n-bes opened 1 year ago

n-bes commented 1 year ago

Hi. I have problem with local copy of reveal.js and highlight.js

Steps

  1. Download highlight.js from https://highlightjs.org/download/ folder and unpack archive to folder

    Highlight.js v11.7.0 (git: 82688fad18)

  2. Download reveal.js from GitHub:

    git clone -b 3.9.2 --depth 1 https://github.com/hakimel/reveal.js.git

  3. asciidoctor-revealjs version:

    ╰─➤  asciidoctor-revealjs-macos --version
    
    Asciidoctor reveal.js 4.1.0 using Asciidoctor.js 2.2.1 (Asciidoctor 2.0.12) [https://asciidoctor.org]
    Runtime Environment (node v12.13.1 on darwin)
    CLI version 3.2.0
  4. Build demo:

    asciidoctor-revealjs-macos demo.adoc

  5. Show directory data:

    ╰─➤  tree -L 1 .
    .
    ├── demo.adoc
    ├── demo.html
    ├── highlight
    └── reveal.js

Code

Comment highlightjsdit, highlightjs-theme to use bundled version.

= Hello
:revealjsdir: reveal.js
:revealjs_theme: white
:revealjs_controls: false
:highlightjsdir: highlight
:highlightjs-theme: highlight/styles/stackoverflow-dark.min.css
:source-highlighter: highlightjs

== Test
[source,java]
----
public class TestClass {
    public TestClass() {

    }

    public void testMethod() {

    }
}
----

[source,java,linenums,highlight=2..3]
----
public class TestClass {
    public TestClass() {

    }

    public void testMethod() {

    }
}
----

Results

Снимок экрана 2023-01-12 в 13 22 04 Снимок экрана 2023-01-12 в 13 22 46

ggrossetie commented 1 year ago

As far as I remember reveal.js 3.9.2 is not compatible with Highlight.js >= 10. You should use highlight.js 9.18.0.

n-bes commented 1 year ago

@Mogztter I found this part: https://github.com/asciidoctor/asciidoctor-reveal.js/blob/19cfd091abd1d5151b614784218cf0feadc6bdef/lib/asciidoctor-revealjs/highlightjs.rb#L9

Originally, i tried to change theme, but without success

ggrossetie commented 1 year ago

this commit is only available on 5.0.0-rc.1 (based on reveal.js 4): https://github.com/asciidoctor/asciidoctor-reveal.js/releases/tag/v5.0.0-rc.1