asciidoctor/asciidoctor-reveal.js

Custom highlight.js display errors

n-bes opened this issue · 3 comments

n-bes commented

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

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

@Mogztter I found this part:

# REMIND: we cannot use Highlight.js 11+ because unescaped HTML support has been removed:

Originally, i tried to change theme, but without success

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