0

I'm using Emacs-Org Mode and Reveal.js for exporting a long PPT/Slides.

I am meeting with the problem of long Table-of-Contents(TOC) problem, the TOC is too long but can not auto page break (the TOC content just missed at the end of the TOC slide)

I've tried "https://github.com/naamor/reveal.js-tableofcontents", but don't understand how to configurate it.

According to the manual in the above link, it says:

Copy this repository into the plugins folder of your reveal.js presentation, i.e. plugins/tableofcontents.

Add the plugin to the dependencies in your presentation:

Reveal.initialize({

    dependencies: [

        { src: 'node_modules/reveal.js-tableofcontents/tableofcontents.js' }
    ]
});

Reveal.initialize({
    // ...

    tableofcontents: {
        // Specifies the slide title of the table of contents slide
        title: "Table of Contents",

        // Specifies the position of the table of contents slide in the presentation
        position: 2,

        // Specifies which slide tag elements will be used
        // for generating the table of contents.
        titleTagSelector: "h1, h2, h3, h4, h5, h6",

        // Specifies if the first slide, mostly the title slide of the presentation, should be ignored.
        ignoreFirstSlide: false,

        // Specifies if every single element of the table of contents
        // will be stepped through before moving on to the next slide.
        fadeInElements: false
    },
});

I tried to put this into my ox-reveal.js, but it does not work.

Please help!

Thanks.


;;...

<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
"
     (format "
controls: %s,
progress: %s,
history: %s,
center: %s,
slideNumber: %s,
rollingLinks: %s,
keyboard: %s,
overview: %s,
"
            (if (plist-get info :reveal-control) "true" "false")
            (if (plist-get info :reveal-progress) "true" "false")
            (if (plist-get info :reveal-history) "true" "false")
            (if (plist-get info :reveal-center) "true" "false")
            (let ((slide-number (plist-get info :reveal-slide-number)))
              (if slide-number (format "'%s'" slide-number)
                "false"))
            (if (plist-get info :reveal-rolling-links) "true" "false")
            (if (plist-get info :reveal-keyboard) "true" "false")
            (if (plist-get info :reveal-overview) "true" "false"))


     ;; slide width
     (let ((width (plist-get info :reveal-width)))
       (cond ((and (integerp width) (> width 0)) (format "width: %d,\n" width))
             ((stringp width) (format "width: '%s',\n" width))
             (t "")))

     ;; slide height
     (let ((height (plist-get info :reveal-height)))
       (cond ((and (integerp height) (> height 0)) (format "height: %d,\n" height))
             ((stringp height) (format "height: '%s',\n" height))
             (t "")))

     ;; slide margin
     (let ((margin (string-to-number (plist-get info :reveal-margin))))
       (if (>= margin 0) (format "margin: %.2f,\n" margin) ""))

     ;; slide minimum scaling factor
     (let ((min-scale (string-to-number (plist-get info :reveal-min-scale))))
       (if (> min-scale 0) (format "minScale: %.2f,\n" min-scale) ""))

     ;; slide maximux scaling factor
     (let ((max-scale (string-to-number (plist-get info :reveal-max-scale))))
       (if (> max-scale 0) (format "maxScale: %.2f,\n" max-scale) ""))

     ;; thems and transitions
     (format "
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || '%s', // default/cube/page/concave/zoom/linear/fade/none
transitionSpeed: '%s',\n"
             (plist-get info :reveal-trans)
             (plist-get info :reveal-speed))

     ;; multiplexing - depends on defvar 'client-multiplex'
     (when (plist-get info :reveal-multiplex-id)
       (format
"multiplex: {
    secret: %s, // null if client
    id: '%s', // id, obtained from socket.io server
    url: '%s' // Location of socket.io server
},\n"
             (if (eq client-multiplex nil)
                 (format "'%s'" (plist-get info :reveal-multiplex-secret))
               (format "null"))
             (plist-get info :reveal-multiplex-id)
             (plist-get info :reveal-multiplex-url)))

     ;; optional JS library heading
     (if in-single-file ""
       (concat
        "
// Optional libraries used to extend on reveal.js
dependencies: [
"
        ;; JS libraries
        (let* ((builtins
                '(classList (format " { src: '%slib/js/classList.js', condition: function() { return !document.body.classList; } }" root-path)
                  markdown (format " { src: '%splugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
 { src: '%splugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }" root-path root-path)
                  highlight (format " { src: '%splugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }" root-path)
                  zoom (format " { src: '%splugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
                  notes (format " { src: '%splugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
                  search (format " { src: '%splugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
                  remotes (format " { src: '%splugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
                  multiplex (format " { src: '%s', async: true },\n%s"
                                    (plist-get info :reveal-multiplex-socketio-url)
                                        ; following ensures that either client.js or master.js is included depending on defva client-multiplex value state
                                    (if (not client-multiplex)
                                        (progn
                                          (if (plist-get info :reveal-multiplex-secret)
                                              (setq client-multiplex t))
                                          (format " { src: '%splugin/multiplex/master.js', async: true }" root-path))
                                      (format " { src: '%splugin/multiplex/client.js', async: true }" root-path)))))
               (builtin-codes
                (mapcar
                 (lambda (p)
                   (eval (plist-get builtins p)))
                 (let ((buffer-plugins (condition-case e
                                           (car (read-from-string (plist-get info :reveal-plugins)))
                                         (end-of-file nil)
                                         (wrong-type-argument nil))))
                   (or (and buffer-plugins (listp buffer-plugins) buffer-plugins)
                       org-reveal-plugins))))
               (external-plugins
                (cl-loop for (key . value) in org-reveal-external-plugins
                         collect (format  value root-path )) )
               (all-plugins (if external-plugins (append external-plugins builtin-codes) builtin-codes))
               (extra-codes (plist-get info :reveal-extra-js))
               (total-codes
                (if (string= "" extra-codes) all-plugins (append (list extra-codes) all-plugins))                )

               )
          (mapconcat 'identity total-codes ",\n")



          )



        "]\n"
         ))


        (let ((init-script (plist-get info :reveal-init-script)))
          (if init-script (concat (if in-single-file "" ",") init-script)))

        ;;saga
        dependencies: [
            "{ src: '%sworks/notes/reveal.js/plugin/tableofcontents.js'}"
        ]

        ;;saga
        tableofcontents: {
        // Specifies the slide title of the table of contents slide
        title: "Table of Contents222",

        // Specifies the position of the table of contents slide in the presentation
        position: 2,

        // Specifies which slide tag elements will be used
        // for generating the table of contents.
        titleTagSelector: "h1, h2, h3, h4, h5, h6",

        // Specifies if the first slide, mostly the title slide of the presentation, should be ignored.
        ignoreFirstSlide: false,

        // Specifies if every single element of the table of contents
        // will be stepped through before moving on to the next slide.
        fadeInElements: false
        }

     "});\n</script>\n")))

;;...

  • "it doesn't work" is a very poor description of the problem. Please give us details. – Stefan Jun 25 at 16:06
  • Actually, I just don't know, how to "Add the plugin to the dependencies in your presentation:" ... I tried to put the code into the ox-reveal.js, but the HTML slide still has not change (no effect) – saga Jun 25 at 16:19
  • I've add the code in the .js file, following the comment of ;;saga (you can search it) – saga Jun 25 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.