HackerHappyHour/reveal

Invalid regex

Opened this issue · 7 comments

When I load the page I get:

highlight.js:2 Uncaught SyntaxError: Invalid regular expression: /([À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(\s*,\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*)*>)?\s+)+[a-zA-Z_]\w*\s*\(/: Range out of order in character class
    at new RegExp (<anonymous>)

as the code is minified, it's not easy for me to identify the true source, but the function is:

        function t(t, r) {
            return new RegExp(n(t),"m" + (e.cI ? "i" : "") + (r ? "g" : ""))
        }

My config:

            Reveal.initialize({
              hash: true,
                dependencies: [
                    // Interpret Markdown in <section> elements
                    { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
                    { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },

                    // Syntax highlight for <code> elements
                    { src: 'plugin/highlight/highlight.js', async: true },
                    { src: 'plugin/notes-server/client.js', async: true },

                ]
            });

How are you installing/including reveal?

npm install ... then symlink js, css, lib, plugin into my workspace.

clumsy, perhaps, but I needed to get the slides done :)

npm install -S @h3/reveal

Sorry for the delayed response! Had a lot going on the last few days. As for the questions, I just wanted to verify you were using @h3/reveal instead of the reveal.js npm install so that we were sure to help you debug correctly.


So the regex would be coming from your HTML used to include markdown. Specifically you would be looking for any <section tags in your HTML that have a data-separator attribute.

We have an example of some regex that we recommend here: https://github.com/HackerHappyHour/reveal/blob/master/docker/markdown/index.html#L28-L32

That specific example is the default regex for our reveal:markdown docker image, and the regex usage is explained in the README for that image here: https://github.com/HackerHappyHour/reveal/tree/master/docker/markdown

If you can share any of your data-separator regex values, I can help troubleshoot for you.

That matches my original suspicion, too. My regexs were copied from your docs examples, and it seemed peculiar to me the error was coming from highlight js.

The section in question is:

                <section
                  data-markdown="slides.md"
                  data-separator="^\r?\n---\r?\n$"
                  data-separator-notes="^Note:"
                  data-charset="utf-8"
                >
                </section>