Coywolf Code Block Enhancer extends the built-in core/code block. In the editor
it adds a “Code language” dropdown to the block sidebar; on the front end
it highlights the code with Prism.js using a custom token palette, prints
the language name as a small label on the block, and pins a
copy-to-clipboard button to the top-right corner.
aria-label, a politedefer strategy so theyThe chosen language is stored as a language block attribute on
core/code, which lives in the block delimiter comment rather than the
saved markup. That means blocks without a language stay valid and
existing content is never migrated.
On render, the plugin uses WP_HTML_Tag_Processor to add data-language
to the <pre> and language-xxx to the <code> server-side — so KSES
won’t strip data-* attributes for non-admin authors, and there is no
block-validation churn.
Prism core and the per-language grammars are bundled under
assets/prism/ at v1.30.0 (MIT — see assets/prism/LICENSE.txt). They
register as deferred scripts with explicit dependency ordering (e.g.
markup-templating before php, clike before languages that extend
it). The copy-button script depends on the last grammar in the chain,
so all of Prism is present before the copy UI is wired up. Reading
code.textContent returns the original source even after Prism wraps
tokens in spans, so the copied text is unaffected by highlighting.
Self-hosting Prism (rather than loading from a public CDN) keeps the
third-party-script supply chain off the plugin’s surface and means the
plugin works on sites with strict CSPs or no external egress.
Privacy-first: this plugin includes no analytics, no tracking, and no data gathering. Nothing about you, your site, or your visitors is ever collected or sent anywhere.