New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Gutenberg block for syntax-highlighted code. #78

merged 1 commit into from Sep 19, 2018


2 participants

iandunn commented Jul 18, 2018

The syntax highlighting only works on the front end, due to the nature of SyntaxHighlighter. Details are documented in the edit() function's docblock.

Because of that, this isn't the ideal syntax highlighting block[1], but this provides a way for existing users to continue using the plugin without having to migrate old posts to a different plugin.

Another limitation is that this PR only supports the language attribute of the shortcode, because I ran out of time/energy. This lays the groundwork, though, so the rest of them can easily be added in a future iteration.

In the repo, you might want to svn:ignore the webpack.config.js, package-lock.json, and package.json files, in order to keep the distributed plugin clean. I'd recommend leaving the blocks/code/index.js source file versioned, though, so that users have access to the raw source (and not just the minified version).

[1]: An ideal solution would probably use Code Mirror, since it's already shipped with Core, and leaves the editable input field in tact.

@iandunn iandunn force-pushed the iandunn:code-block branch from 4da82c9 to 66322c1 Jul 18, 2018


This comment has been minimized.


Viper007Bond commented Sep 19, 2018

Sweet! Thanks for giving this neglected plugin some love. ❤️

@Viper007Bond Viper007Bond merged commit 4a273db into Viper007Bond:master Sep 19, 2018


This comment has been minimized.


iandunn commented Sep 19, 2018

No problem, I still use it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment