Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin match-braces does not work with a custom prefix from custom-class plugin #2933

Closed
mmena1 opened this issue Jun 4, 2021 · 0 comments · Fixed by #2947
Closed

Plugin match-braces does not work with a custom prefix from custom-class plugin #2933

mmena1 opened this issue Jun 4, 2021 · 0 comments · Fixed by #2947
Assignees

Comments

@mmena1
Copy link

mmena1 commented Jun 4, 2021

Information:

  • Prism version: latest from the download page
  • Plugins: match-braces, custom-class
  • Environment: Browser

Description
When using the plugin match-braces alongside custom-class plugin it works fine, unless you declare a custom prefix.

e.g.

Prism.plugins.customClass.prefix('pr-');

Most likely it's because this line is using the wrong selectors.

So, instead of:

var punctuation = Array.prototype.slice.call(code.querySelectorAll('span.token.punctuation'));

It should be something like:

var punctuation = Array.prototype.slice.call(code.querySelectorAll(`span.${prefix}token.${prefix}punctuation`));

I'm not sure how to get the prefix though, but I believe it's stored somewhere.

Example
JSFiddle

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

Successfully merging a pull request may close this issue.

2 participants