[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.
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.
<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>- Open the page.
- In the console, run
P.pluginRegistry.peek('filter-highlight-all').plugin.filterKnown. - Inspect the
code.skipblock.
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
Source: PrismJS/prism