SyntaxHighlighter Evolved

Description:

As seen on WordPress.com.

SyntaxHighlighter Evolved allows you to easily post syntax-highlighted code to your site without having to escape the code or anything. It uses the SyntaxHighlighter JavaScript package by Alex Gorbatchev to do the highlighting and supports all of the package’s parameters via shortcode attributes.

For a list of supported languages (most widely used languages are supported), see the WordPress.com support document.

Example Code Output:

Note that there are various different color schemes available.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>PHP Code Example</title>
</head>
<body>
	<h1>PHP Code Example</h1>

	<p><?php echo 'Hello World!'; ?></p>

	<p>This line is highlighted.</p>

	<div class="foobar">
		This	is	an
		example	of	smart
		tabs.
	</div>

	<p><a href="http://wordpress.org/">WordPress</a></p>
</body>
</html>

If you prefer, you can hide the line numbering and other UI stuff with the “light” mode, for example:

[php light="true"]your code here[/php]

There are many other parameters and defaults you can control via the Settings page or the shortcode parameters. Full details and instructions are located at the bottom of the Settings page.

Download:

GitHub:

This plugin is available on GitHub. Issues, patches, and pull requests are welcome.

https://github.com/Viper007Bond/syntaxhighlighter

1,646 thoughts on “SyntaxHighlighter Evolved

  1. i have found a Exception :/
    PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ‘;’ in Entity, line: 1108 in /wp-content/plugins/insert-php-code-snippet/shortcode-handler.php(26) : eval()’d code on line 3

  2. Pingback: ???????????? | ZZ'BLOG

  3. Pingback: Dashboard graphics with R | NorCalBiostat

  4. Pingback: Hello world! | user's Blog!

  5. Pingback: First post | gdappdelegate

  6. Pingback: ???????????????????? | generative design workshop

  7. Pingback: WordPress??????SyntaxHighlighter?????? | foctc.com

  8. Pingback: Adieu SyntaxHighlighter

  9. Pingback: Everyday Microsoft Technology | Sytax Highlighter

  10. Pingback: Test av inlägg med programkod - Genuin IT AB

  11. Pingback: How to: Textarea that can do syntax highlighting on the fly? | SevenNet

  12. Using the default twentyfifteen theme, the gutter with line numbers do not appear in syntaxhighlighter. Changing back to twentytwelve that I had been using before restores this functionality.

  13. Hi, fab plugin – I’m going through my post history and updating them with the code tags.
    Mostly working fine, but on one of my (longer) posts, it’s changing any symbols ( , ” etc) to their HTML code. My other posts are rendering fine – so wonder if there might be something I should look out for in the rest of my post which could be conflicting? Using these symbols in the main body works fine – just not in the text/code blocks. Thanks!

    • The plugin escapes HTML that is within it’s shortcodes behind the scenes and before it goes into the database so that if the plugin is disabled, the HTML doesn’t suddenly start rendering. However when you go to edit the post, it should reverse the process so that it looks the same within the editor.

Leave a Reply