Skip to content

Repository files navigation

Code Enhance

CI Release License: GPL v2 or later

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

Features

  • 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)

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • Node 24+ (development / packaging only)

Install (WordPress)

From a release zip

  1. Download code-enhance-*.zip from Releases.
  2. In WP Admin → Plugins → Add New → Upload Plugin, upload the zip and activate Code Enhance.
  3. Edit a post, insert a Code block, open the Code Enhance panel.

From source

git clone https://github.com/zeddotes/code-enhance.git
cd code-enhance
nvm use
npm install
npm run build

Copy or symlink this directory into wp-content/plugins/ (folder name can be code-enhance), then activate the plugin.

Development

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>.zip
  • dist/code-enhance.zip

Zip layout matches WordPress upload expectations: one root folder code-enhance/ containing code-enhance.php, readme.txt, and build/.

CI and releases

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.

Contributing

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.

Project layout

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

License

GPL-2.0-or-later. See LICENSE.

Prism.js is MIT-licensed and bundled in the build.

Author

Zain Syed (@zeddotes)

About

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.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages