A WordPress plugin for creating Gutenberg blocks for displaying syntax highlighted snippets to blog posts
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
blocks
languages
lib
.babelrc
.gitignore
README.md
package-lock.json
package.json
rba-codeblock.php
webpack.config.js

README.md

rba-codeblock

A WordPress plugin for creating Gutenberg blocks for displaying syntax highlighted snippets to blog posts

Warning: This is an experimental plugin which is probably insecure. Use at your own risk!

Usage

The Gutenberg plugin must be installed and active in order for this plugin to operate.

Upon activation a new block called Code snippet will appear in the list of blocks available.

Click on this block and start writing code!

To change the language used (default is css) open the block inspector (on the right-hand side of the Gutenberg editor). From there you can change the language.

You can choose to show or hide line numbers in the controls that appear above the block when it has focus.

Known issues

For some reason when editing a page with multiple code snippet blocks changing the language or line number settings changes the wrong editor. However upon saving and updating the correct settings should show. Does not affect the front end.

Credits

Credit should go to Zac Gordon, whose guide at https://gutenberg.courses/development/ forms the basis of this plugin. Any mistakes are probably mine and not his!