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

Autoloader Plugin causes Command Line Plugin to run twice when used from CDN breaking data-filter-* on <pre> #3774

Open
Soyvolon opened this issue Feb 12, 2024 · 0 comments

Comments

@Soyvolon
Copy link

Information:

  • Prism version: v1.29.0 via CDN
  • Plugins: Autoloader, Command Line
  • Environment: Browser

Description

This bug occurs when Prism is loaded from a CDN or in a manner similar to a CDN. It does not occur when using a packaged bundle from the website.

When the Autoloader and Command Line plugins are both loaded, the Autoloader plugin causes Prism to scan a document for code boxes twice. When using the Command Line plugin with the data-filter-output="(out)" or the data-filter-continuation="(con)" attribute, the plugin outputs the expected result on the first pass - removing the prefixes and setting the lines to outputs. When Autoloader causes it to run a second time (once the grammar loads, I would assume), there are no longer any prefix on the code block lines, causing the Command Line plugin to think that every line is an input line.

Example

GitLab - contains example .html files and download copy of the Autoloader and Command Line plugins for testing. The files ending in from_git have a copy and pasted version of this file that I used to try and debug what was happening.

JSFiddles (for the .html files in the repo):

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

No branches or pull requests

1 participant