#4128·prism

[v2] Filter highlightAll: data-* attributes on the script tag are ignored

Author: DmitrySharabinCreated Sep 24, 2026Updated Sep 24, 2026

Filter highlightAll ignores its data-* attributes in V2: the plugin reads them from document.currentScript, which is null for module scripts.

https://github.com/PrismJS/prism/blob/719a11f083e9b856c1058fab75c7b4d4944958c8/src/plugins/filter-highlight-all/filter-highlight-all.js#L96-L112

V2 ships the plugin only as an ES module, and dist/prism.js (the one classic-script build) doesn't include it, so no <script> can carry the attributes.

xml
<script type="module" src="https://v2.dev.prismjs.com/dist/index.js"></script>
<script type="module" src="https://v2.dev.prismjs.com/dist/plugins/filter-highlight-all.js" data-filter-known data-reject-selector="code.skip"></script>
<script type="module">
	import Prism from "https://v2.dev.prismjs.com/dist/index.js";
	window.P = Prism;
</script>
<pre><code class="language-javascript skip">let a = 1;</code></pre>
  1. Open the page.
  2. In the console, run P.pluginRegistry.peek('filter-highlight-all').plugin.filterKnown.
  3. Inspect the code.skip block.

Expected: filterKnown is true, and the code.skip block is not highlighted. Actual: filterKnown is false, and the code.skip block is highlighted (4 tokens). Prism v2 (v2 @ 719a11f0), Chrome