WordPress plugin that extends the core Code block (core/code) for technical authors — language-aware Prism highlighting, line numbers, tab/indent controls, and a configurable copy button.
No separate block type. Authors keep inserting the standard Code block; Code Enhance adds a Code Enhance panel in the sidebar.
Repository: github.com/zeddotes/code-enhance
- Language select with Prism.js highlighting in the block editor and on the frontend
- Optional line numbers
- Tab stays inside the block and indents; Shift+Tab outdents
- Indent with spaces or tabs; tab size 2 / 4 / 8
- Optional copy button before or after the code block (left / center / right), or hidden
- Bundled Prism (no CDN, no remote calls)
- WordPress 6.0+
- PHP 7.4+
- Node 24+ (development / packaging only)
- Download
code-enhance-*.zipfrom Releases. - In WP Admin → Plugins → Add New → Upload Plugin, upload the zip and activate Code Enhance.
- Edit a post, insert a Code block, open the Code Enhance panel.
git clone https://github.com/zeddotes/code-enhance.git
cd code-enhance
nvm use
npm install
npm run buildCopy or symlink this directory into wp-content/plugins/ (folder name can be code-enhance), then activate the plugin.
nvm use
npm install
npm start # watch build| Script | Purpose |
|---|---|
npm start |
Development watch build |
npm run build |
Production assets into build/ |
npm run package |
Build + WordPress upload zip in dist/ |
Packaging produces:
dist/code-enhance-<version>.zipdist/code-enhance.zip
Zip layout matches WordPress upload expectations: one root folder code-enhance/ containing code-enhance.php, readme.txt, and build/.
| Workflow | Trigger | What it does |
|---|---|---|
| CI | Pull requests and pushes to main |
npm ci, build, verify assets, package zip, upload artifact |
| Release | Push to main |
If v<package.json version> does not exist yet, package the plugin and create a GitHub Release with the zip attached |
To cut a new release: bump the version in package.json, readme.txt (Stable tag), and code-enhance.php, open a PR, merge to main. The Release workflow tags vX.Y.Z and publishes the zip.
Merges that do not change the version still run CI; they do not recreate an existing tag.
Collaboration is welcome.
- Bugs and features: open an issue using the templates — New issue
- Browse issues: Issues
- Pull requests: fork, branch from
main, keep changes focused, ensure CI passes
See CONTRIBUTING.md for setup, issue guidelines, and the release versioning rule.
code-enhance.php # Plugin bootstrap + asset enqueue
src/ # Editor + frontend sources
build/ # Compiled assets (generated)
bin/package-plugin.sh # WordPress zip packager
readme.txt # WordPress.org-style readme
GPL-2.0-or-later. See LICENSE.
Prism.js is MIT-licensed and bundled in the build.