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,818 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. I see that someone posted about the issue with twentyfifteen at wordpress.org/support/topic/broken-on-2015-theme

  14. 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.

  15. Pingback: Menuliskan Baris Perintah dalam WordPress | chaplux

  16. Pingback: 40+ ESSENTIAL WORDPRESS PLUGINS - DostiFun

  17. Pingback: Scripts Linux | SOSpedia punto net

  18. Pingback: Get a site like mine! | Ramblings

  19. Pingback: WordPress??????SyntaxHighlighter?????? | Tan_Jin's Blog

  20. Pingback: Best Wordpress syntax hightlighter plugin: SyntaxHighlighter Evolved - Minh Thang's Blog

  21. Pingback: ?-????? | ?????

  22. Hey. I was using a different one that wasn’t as good. Switched to yours, which is better. However, I have hundreds of posts with many snippets marked as XAML, as I coded in WPF for a long time. Everytime there is an update, I have to edit syntaxhighlighter/syntaxhighlighter.php and manually add this brush alias:

    ‘xaml’ => ‘xml’,

    Do you think you could add that to your brush aliases for next release?

  23. I’m surprised it works because I didn’t think it would as xaml is not a recognized alias:

    https://github.com/Viper007Bond/syntaxhighlighter/blob/3d2ee77a46ce9bfd6c25a95cca84068fa664ce8f/syntaxhighlighter3/scripts/shBrushXml.js#L65

    As documented here, you can just add this to your theme’s functions.php file though to avoid editing the plugin:

    add_filter( 'syntaxhighlighter_brushes', function( $brushes ) {
    	$brushes['xaml'] = 'xml';
    
    	return $brushes;
    } );
  24. Pingback: WordPress???? SyntaxHighlighter Evolved – w1100n

  25. Pingback: Formatting in WordPress | Andrew's Blog

  26. Pingback: 25 Syntax Highlighters: Tried and Tested « site design

  27. Pingback: 25 Syntax Highlighters: Tried and Tested - Innovative Studio

  28. Pingback: 25 Syntax Highlighters: Tried and Tested | Web Technologies

  29. Pingback: 25 Syntax Highlighters: Tried and TestedFree Internet Tutorials | Free Internet Tutorials

  30. Pingback: 25 Syntax Highlighters: Tried and Tested | The Web Geek

  31. Pingback: Getting highlighting with SyntaxHighlighter Evolved

  32. Pingback: WordPress??????SyntaxHighlighter????(?) | Welcome

  33. Pingback: Developer's blog | amazon-ec2-using-smart-update-to-wordpress-plugins

  34. Pingback: WordPress??????SyntaxHighlighter????(?) | Welcome

  35. Pingback: ??? ????? ???????????? | ?????????-????-?-??????-??????????????-????????????-?-wordpress-syntaxhighlighter-?-comment-form

  36. Hi. Thanks for this nice plugin. I have but one problem with it: how is it possible to use the syntax highlighting within a paragraph? I would like to refer to parts of the code within a sentence and use the same highlighting for that, but I can’t seem to find a way to do that.

  37. Pingback: WordPress blog için gerekli 10 eklenti | KirmiziKit :d

  38. Great plugin! What would like is that the syntax for all code tags is left aligned except for de txt-tag. The syntax for de txt-tag has to be centered. Is that possible? I have experimented a bit with the class but can not get done this.

  39. Pingback: ?????????? ???????????? ????? — ??????? 1 | Seo-New

  40. Pingback: Test… SyntaxHighlighter

  41. Pingback: Incrustar “gists” de github en WordPress

    • Those were only needed in the old version of the highlighting library because when you used to highlight the code with your mouse, it would also include the line numbers. In the latest version which my plugin uses, you can copy the code just like you would any other text.

      However if you want to switch back to the older version of the library, you can do so from the top of this plugin’s settings page. Due to a security issue though, the copy to clipboard button will not work. It required a Flash file to work and the file had security issues so I was forced to remove it.

  42. Pingback: SyntaxHighlighter Evolved | WP Plugin Directory

Comments are closed.