WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by jesucarr v1.2.1

Prettify Code Syntax

Code syntax highlighter using Google Prettify, supporting the HTML5 recommendation, and caching plugins.

Prettify Code Syntax

The facts

Rating
4.2★ from 12
Active installs
80+
Price
Free
Last updated
21 Mar 2013
Added
Feb 2013
Requires WP
3.0.1
Tested up to
WP 3.5.2
Downloads
16,314

Our analysis

AI-assisted

Prettify Code Syntax is a WordPress plugin designed to enhance the presentation of code snippets on your site. It supports HTML5 recommendations by allowing code to be tagged appropriately, and it works with various programming languages. The plugin is based on Google Code Prettify and offers several styling options to suit different themes.

This plugin is suitable for developers or website owners who want to display code snippets clearly and attractively. It is particularly useful for those who need to showcase programming languages in a visually appealing format while maintaining performance through caching support.

Best for: This plugin suits developers and content creators who need to display code snippets on their WordPress sites.

What it does well

  • Supports multiple programming languages
  • Follows HTML5 recommendations for code presentation
  • Offers four different styles and custom styling options
  • Compatible with caching plugins like W3 Total Cache

Where it falls short

  • Last updated in March 2013
  • Tested only up to WordPress version 3.5.2
  • Limited support for some languages due to commenting conventions

Verdict

Prettify Code Syntax provides a straightforward solution for code highlighting, but its age and limited updates may be a concern for some users.

From the developer

jesucarr's own description of Prettify Code Syntax, lightly tidied.

The main reason for the development of this plugin was the lack of options supporting the HTML5 recommendation, where the code snippets should be tagged with pre followed by code, and optionally a class starting with language- and then our language.

You can use the plugin like this:

<pre class="prettyprint"><code class="language-php">
// my code
</code></pre>

Also very important is that although this plugin loads different files depending on your configuration, it fully supports caching scripts (W3 Total Cache) to concatenate and compress all the css and js, so the impact in performance will be minimum.

Languages

This syntax highlighter is based on Google Code Prettify and should work on a number of languages including C and friends, Java, Python, Bash, SQL, HTML, XML, Javascript, Makefiles, and Rust. It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl and Ruby, but, because of commenting conventions, doesn’t work on Smalltalk.

Other languages are supported via an extension (plugin options): CSS, SQL, YAML, Visual Basic, Clojure, Scala, Latek (TeX, LaTeX), WikiText, Erlang, Go, Haskell, Lua, OCAML, SML, F#, Nemerle, Protocol Buffers, CHDL (VHDL), XQ (XQuery), Lisp, Scheme, Dart, Llvm, Mumps, Pascal, R, S, RD, TCL

Styles

Four different styles are provided, and they can be previewed in the plugin options. They are modified to make sure they don’t clash with any other styles in your theme.

You have also the option to include your custom style.

If you have a style that would like to see included in the option list, just contact me, or fork me.

Notes

  • Plugin options are at Settings > Prettify Code Syntax. Have a look at the Screenshots tab to see how it looks like.

  • If you don’t care too much about the HTML5 recommendation, you can skip the language- class. The code always gets detected automatically.

  • It will also work if you only use a pre tag without the code tag (but long lines will be wrapped instead of get horizontal scroll), or if you only use a code tag with the prettyprint class (but if you don’t use pre your spaces/returns won’t be maintained.)

  • Be careful using the Visual Editor tab when inserting code, as some HTML tags will be modified or removed.

  • Using a chaching plugin like W3 Total Cache is highly recommended.

Demo

You can find a front end demo here a the bottom.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for making sites fast.

WP-Optimize

Get caching and more with this powerful cache plugin. Cache, optimize images, clean your database and minify f...

Free 1M+ installs 4.8★ (2,606)
LiteSpeed Cache

All-in-one unbeatable acceleration &amp; PageSpeed improvement: caching, image/CSS/JS optimization...

Free 7M+ installs 4.8★ (2,764)
EWWW Image Optimizer

Comprehensive image optimization with WebP, AVIF, Lazy Load, and more. Optimize images automatically for Faste...

Free 1M+ installs 4.8★ (1,838)
Under Construction

Easy to use Under Construction Page &amp; Coming Soon Page. Enable Under Construction Mode in seconds &amp; sh...

Free 600k+ installs 4.8★ (1,285)
Smush

Smush

93

Compress and optimize images, enable lazy load, serve WebP &amp; AVIF, and speed up your site with a global im...

Free 1M+ installs 4.8★ (6,051)
Converter for Media

Speed up your website by using our WebP &amp; AVIF Converter. Optimize images and serve WebP and AVIF images i...

Free 500k+ installs 4.9★ (1,097)