Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

Invalid regex #58

Open
funkybob opened this issue Aug 19, 2019 · 7 comments
Open

Invalid regex #58

funkybob opened this issue Aug 19, 2019 · 7 comments

Comments

@funkybob
Copy link

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" : ""))
        }
@funkybob
Copy link
Author

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 },

                ]
            });

@LongLiveCHIEF
Copy link

How are you installing/including reveal?

@funkybob
Copy link
Author

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

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

@LongLiveCHIEF
Copy link

LongLiveCHIEF commented Aug 22, 2019 via email

@funkybob
Copy link
Author

npm install -S @h3/reveal

@LongLiveCHIEF
Copy link

LongLiveCHIEF commented Aug 27, 2019

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.

@funkybob
Copy link
Author

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>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants