没有不值得去解决的问题,也没有不值得去学习的技术!

Say Goodbye to Flickering and Uncopyable Code: Smoothly Migrate From SyntaxHighlighter to Code Block Pro

Figure 5: Compatibility test passed

作者:

在

As a technical blogger, the quality of code presentation directly impacts the reader’s experience. I had been using the SyntaxHighlighter Evolved plugin, but as my expectations for user experience grew, I gradually identified several pain points with it. After repeated trials and comparisons, I ultimately chose Code Block Pro.

Below is my complete migration journey and testing report.


1. Why Stop Patching SyntaxHighlighter?

My initial thought was simple: since I was comfortable using SyntaxHighlighter Evolved, I would just add CSS and JS on top of it to manually implement language labels and a copy button.

However, after multiple attempts, I gave up.

There are three reasons:

  1. Complex DOM structure: The HTML structure rendered by SyntaxHighlighter is deeply nested, making it difficult for CSS selectors to accurately target the desired elements.
  2. High risk of JS conflicts: Adding custom JS easily conflicts with the plugin’s built-in scripts, causing highlighting to fail.
  3. High maintenance cost: With every plugin update, the custom code could be overwritten or broken.

The final conclusion: rather than patching it, it is better to switch directly to a plugin that natively supports these features.


2. Two Core Pain Points of SyntaxHighlighter Evolved

Before deciding to switch, I outlined the two most unbearable issues with SyntaxHighlighter Evolved (the WordPress version I used for testing was 7.0):

Pain Point 1: No Language Label or Copy Button

These are the most basic functional requirements. Readers need to know what language the code is written in, and they need a one-click copy button.

Figure 1: Code block rendered by SyntaxHighlighter Evolved, with no language label and no copy button

Figure 1: Missing language label and copy button

As seen in the image above, the top of the code block is completely empty, with no prompt information and no copy button.

Pain Point 2: Front-end Rendering Causes Page Flickering

This is a more severe technical issue. SyntaxHighlighter Evolved uses front-end JavaScript rendering (based on highlight.js), following this process:

  1. Browser loads the page → code is displayed as plain text
  2. Loads JS files → parses the code
  3. Applies highlighting styles → code turns colorful

During this process, readers see the code suddenly “change” from plain text to colorful, causing a flicker that significantly impacts the first impression.

Figure 2: Plain text is displayed first upon page load, flickering before turning into colorful highlighting

Figure 2: Flickering issue caused by front-end rendering

3. Why Did I Ultimately Choose Code Block Pro?

While researching alternatives, I focused on several dimensions: rendering method, language support, theme variety, and most importantly, compatibility with old articles.

Code Block Pro ultimately won for the following reasons:

Comparison DimensionSyntaxHighlighter EvolvedCode Block Pro
Rendering methodFront-end JS rendering (flickers)Server-side rendering (no flickering)
Language label❌ Not supported✅ Supported
Copy button❌ Not supported✅ Supported
Highlighting enginehighlight.jsSame engine as VS Code
Language supportAbout 30140+
ThemesA few fixed styles25+, including Light Plus, Dark Plus, etc.

Why Choose the Light Plus Theme?

You might have noticed that I ultimately chose the Light Plus theme (white background).

The reason is simple: I found that code examples generated by current mainstream AI coding assistants (such as ChatGPT, Claude, Copilot, etc.) almost exclusively use Light themes with white backgrounds.

This has become an industry-default presentation habit:

  • White backgrounds are clearer to read in light mode
  • Screenshots of AI-generated code mostly use light themes
  • Most technical documentation and blogs also use light code backgrounds

Therefore, to keep the code examples in my blog consistent with the style of AI-generated code, I chose the Light Plus theme.


4. Installation and Testing Process

4.1 Installing Code Block Pro

Search for and install Code Block Pro in the WordPress dashboard.

Figure 3: Searching for Code Block Pro in the plugin marketplace and installing it

Figure 3: Search results and installation interface

Click “Install Now” and activate it.

4.2 Configuring the Code Block

Add a Code Pro block in the Gutenberg editor, paste the Go language test code, and configure it in detail using the right-hand panel.

Figure 4: Code Block Pro settings panel and live preview

Figure 4: Selecting language Go, theme Light Plus, enabling line numbers

Key configuration options:

  • Language: Select Go (supports 140+ languages)
  • Theme: Select Light Plus (white background, consistent with AI-generated style)
  • Line numbers: Enabled, starting number set to 1
  • Line highlighting: Highlight specific code lines as needed

4.3 Compatibility Test: Can the New and Old Plugins Coexist?

This was my biggest concern. If Code Block Pro conflicted with SyntaxHighlighter Evolved, all old articles would be affected.

I inserted both types of code blocks into the same article:

  • One using Code Block Pro (inserted via the Gutenberg Code Pro block)
  • One using SyntaxHighlighter Evolved (inserted via the SyntaxHighlighter Code block)

The test results were as follows:

Figure 5: The new and old plugins coexist independently in the same article without interfering with each other

Figure 5: Compatibility test passed

The conclusion is very clear: the two coexist perfectly.

  • Code Block Pro only processes code inserted via the Code Pro block
  • SyntaxHighlighter Evolved continues to process old code inserted via the SyntaxHighlighter Code block
  • Their CSS and JS do not pollute each other; each renders independently

5. Migration Strategy: Gradual Replacement, No Need to Modify Everything at Once

Based on the compatibility test above, I formulated the following migration strategy:

Option 1: Gradual Migration (Recommended)

For old articles, temporarily keep the code blocks using SyntaxHighlighter Evolved without making any modifications. Use Code Block Pro exclusively for new articles.

Benefits of this approach:

  • Zero risk, no need to batch modify historical articles
  • New and old articles each use the most suitable plugin
  • Over time, the proportion of old articles naturally decreases

Option 2: Keep Old Articles, Use New Plugin for New Articles

If you, like me, have a large number of historical articles, this is the most practical approach.

If you have already installed and activated Code Block Pro, the Code Pro block should display normally in the default block editor of WordPress 7.0. You just need to insert it into new articles.


6. Final Experience Summary

After thorough testing and comparison, I summarized the core experiences of the two plugins as follows:

Experience DimensionSyntaxHighlighter EvolvedCode Block Pro
Loading speed⭐⭐ Flickering delay⭐⭐⭐⭐⭐ Instant display
Highlighting effect⭐⭐⭐ Traditional style⭐⭐⭐⭐⭐ VS Code level
Language support⭐⭐ About 30⭐⭐⭐⭐⭐ 140+
Language label❌✅
Copy button❌✅
Theme variety⭐⭐⭐⭐⭐⭐⭐ 25+
Compatibility with old articles—✅ Perfect coexistence

7. Conclusion

If you are also a SyntaxHighlighter Evolved user, troubled by the flickering issue and the lack of a language label/copy button, I strongly recommend trying Code Block Pro.

Not only does it solve all the above pain points, but it also gives you a VS Code-like code reading experience in WordPress. Moreover, because it coexists perfectly with the old plugin, you can migrate gradually with zero risk, without needing to modify all historical articles at once.

I hope this testing report is helpful to you. If you have any questions, feel free to discuss in the comments section!

系列导航

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系