Title: Replacing code-syntax-block plugin
Last modified: May 8, 2025

---

# Replacing code-syntax-block plugin

 *  Resolved [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * (@jpnl)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/)
 * Hi,
 * I just found that the [original plugin](https://wordpress.org/plugins/code-syntax-block/)
   from which yours is forked, has been closed recently. Since it’s a fork, I though
   I could probably switch plugins, but unfortunately that causes existing code 
   blocks to be invalid and a recovery attempt fails.
 * Do you think there is an easy fix for that? I’d prefer to use a plugin that’s
   in active development, but loosing over 400 code blocks isn’t an option, unfortunately.
 * Thanks
   JP

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18456664)
 * While my plugin is a fork, the codebase is basically a complete rewrite. My approach
   was to extend the Code block in core rather than to introduce a new block, so
   if you can somehow convert all of your blocks into core’s Code block then this
   plugin could be used instead.
 * I suppose my plugin could try to add a facility to migrate blocks from that other
   plugin over to Code blocks, but I don’t have much time to investigate that right
   now.
 *  Thread Starter [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * (@jpnl)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18456897)
 * Thank you for your reply.
 * The other plugin also build on top of the code block from core. It only adds 
   a ‘lang’ and ‘class’ element to the <code> tag.
 * This is the html in the revision history of a core code block without the other
   plugin.
 *     ```wp-block-code
       <!-- wp:code --><pre class="wp-block-code"><code>This is code</code></pre><!-- /wp:code -->
       ```
   
 * This is the same with the other plugin with the code language set to CSS
 *     ```wp-block-code
       <!-- wp:code --><pre class="wp-block-code"><code lang="css" class="language-css">This is code</code></pre><!-- /wp:code -->
       ```
   
 * And this is your plugin with the code language set to CSS
 *     ```wp-block-code
       <!-- wp:code {"language":"css"} --><pre class="wp-block-code"><code>This is code</code></pre><!-- /wp:code -->
       ```
   
 * I see that the other plugin adds the extra settings into the <code>element, while
   your plugin adds them into the <!– wp:code –> line.
 * It looks like your method is the correct method, because the blocks remain valid
   when I disable your plugin, while they become invalid when I disable the other
   plugin.
 * I’ll see if I can make a database query to replace <code anything> with just 
   <code>.
 * Does you plugin have a setting to change the color schema to black background?
   The other one has a an option in settings » Code Syntax Block.
 * Thanks
   JP
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18457072)
 * Yea, you can change the color scheme. This is exposed in the Customizer, which
   isn’t the most discoverable way to do so anymore, I recognize.
 * You can also set the color scheme programmatically: [https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#specifying-the-styles](https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#specifying-the-styles)
 *  Thread Starter [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * (@jpnl)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18458410)
 * Thanks, I switched.
 * Removing the excessive code from the old plugin from the database went pretty
   smooth.
 * The customizer link isn’t available in the backend when using the Twenty Twenty-
   Five theme, but I could still get there by going to `https://mydomain.com/wp-
   admin/customize.php`.
 * It would be nice to also have toggles there for wrapLines and showLineNumbers
   🙂
 * Thanks you for your help!
   JP
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18458617)
 * There’s an issue open for improving discoverability of the settings without relying
   on the Customizer: [https://github.com/westonruter/syntax-highlighting-code-block/issues/253](https://github.com/westonruter/syntax-highlighting-code-block/issues/253)
 * That will likely entail a larger effort by also adding live previews in the editor
   itself: [https://github.com/westonruter/syntax-highlighting-code-block/issues/8](https://github.com/westonruter/syntax-highlighting-code-block/issues/8)
 * And yes, it would be nice if there were checkboxes for highlighting lines, but
   actually there is another option now in that the Code block in core supports 
   inline formatting. This isn’t supported yet in this plugin, but ideally you could
   add links to bits of code and highlights using the core UI and then also get 
   the syntax highlighting. Issue: [https://github.com/westonruter/syntax-highlighting-code-block/issues/205](https://github.com/westonruter/syntax-highlighting-code-block/issues/205)
 *  Thread Starter [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * (@jpnl)
 * [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18458908)
 * Thanks, good to know. 
   I didn’t mean checkboxes for highlighting lines. I mean
   having toggles or checkbox in the customizer to enable line numbers and line 
   wrapping by default, which currently needs to be done with a small plugin as 
   you suggest [here](https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaults).
   I did it that way, but it’s easier to have a toggle somewhere in the settings.
   Lot’s of nice features that, unfortunately, are hidden.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Replacing code-syntax-block plugin’ is closed to new replies.

 * ![](https://ps.w.org/syntax-highlighting-code-block/assets/icon.svg?rev=3406002)
 * [Syntax-highlighting Code Block (with Server-side Rendering)](https://wordpress.org/plugins/syntax-highlighting-code-block/)
 * [Support Threads](https://wordpress.org/support/plugin/syntax-highlighting-code-block/)
 * [Active Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/replacing-code-syntax-block-plugin/#post-18458908)
 * Status: resolved