org-reveal icon indicating copy to clipboard operation
org-reveal copied to clipboard

Using plugins seems broken with current reveal.js

Open tinloaf opened this issue 3 years ago • 2 comments

If I set #+REVEAL_PLUGINS: (notes highlight), this results in these lines being added to the Reveal.initialize() call:

// Optional libraries used to extend on reveal.js
dependencies: [
 { src: 'http://localhost:8000/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
 { src: 'http://localhost:8000/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }]

I can't see any other effect. The plugins do not seem to be loaded in my presentation.

However, the reveal.js Docs specify that to use these two plugins, this code must be added:

<script src="plugin/highlight/highlight.js"></script>
<script src="plugin/notes/notes.js"></script>
<script>
  Reveal.initialize({
    plugins: [ RevealHighlight, RevealNotes ]
  });
</script>

I got these two plugins working in my presentation with the changes from PR #473 and these three option lines:

#+REVEAL_EXTRA_SCRIPT_SRC: plugin/notes/notes.js
#+REVEAL_EXTRA_SCRIPT_SRC: plugin/highlight/highlight.js
#+REVEAL_INIT_OPTIONS: plugins:[RevealNotes, RevealHighlight]

However, #+REVEAL_PLUGINS seems non-functional at the moment.

tinloaf avatar Feb 01 '22 11:02 tinloaf

With the updated PR #473, plugin loading can now be achieved with:

#+REVEAL_EXTRA_SCRIPT_BEFORE_SRC: plugin/notes/notes.js
#+REVEAL_EXTRA_SCRIPT_BEFORE_SRC: plugin/highlight/highlight.js
#+REVEAL_INIT_OPTIONS: plugins:[RevealNotes, RevealHighlight]

tinloaf avatar Feb 01 '22 15:02 tinloaf

But org-reveal has been updated to keep up with the new plugin codes.

The plugin code

// Optional libraries used to extend on reveal.js
dependencies: [
 { src: 'http://localhost:8000/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
 { src: 'http://localhost:8000/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }]

is for reveal.js 3.x.

It is mostly possible that org-reveal failed to detect the reveal.js version. Please try to set it explicitly by

#+REVEAL_REVEAL_JS_VERSION: 4

yjwen avatar Feb 06 '22 11:02 yjwen

@yjwen The hightlight.js css file is broken i think . You have

(defcustom org-reveal-highlight-css "%r/lib/css/zenburn.css" "Highlight.js CSS file." :group 'org-export-reveal :type 'string)

Which wont work with current Reveal version as the css is inside "%r/plugin/highlight/zenburn.css"

anoopd avatar Nov 14 '22 08:11 anoopd