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,447 thoughts on “SyntaxHighlighter Evolved

  1. When I use the title=”" attribute, it is mangled after I click Save. An example:

    [vb title="Endless program written in BASIC"][/vb]

    Comes out as

    [vb title="Endless 1=in 2=BASIC"][/vb]

    Any ideas?

  2. Its a nice work,many many thanks.But I think it has one issue,a suicidal daring act.Putting dangerous code with encoding html entities.And let the plugin do automatic formatting.

    Say if some how this plugin ceased to work,or in future it might not supported by wordpress,or you might to move on a better option-but all the codes are published without formatting.

    My question is how to disable this auto formatting that is html entities encoding,I like to publish encode code myself. Again thanks for this great work.

  3. Hello, can you tell me how best to hardcode this into a theme? I’ve tried using (checked ‘load all brushes’) along with several others with no success.

    Thank you!

  4. Hello, I’ve installed the plugin but it doesn’t work on my current theme and I couldn’t find out the reason. Can you please help me on it?!

  5. Nice plugin, I’ve been using it for a while on wordpress.com. When I use it on wordpress.org, the lines are never wrapped though. What can I do to wrap them? This is my tag, for instance:

  6. Hi Viper, do you know how I can add padding to the left of the code box, because when I’m not using line numbers there’s no padding at all, and it looks strange! See http://www.luigip.com/?p=82

    I’ve changed some of the attributes in the cssCore.css file (which is how I got the inset shadow and rounded corners), but adding padding in the `.syntaxhighlighter textarea {` section puts padding around all elements, in the middle of the code. (Editing the cssCoreDefault.css file doesn’t seem to do anything at all.) Any ideas?

    (BTW you might like to try the Akismet plugin to stop all the spam comments here. It works for me!)

    1. You’re kind of on your own for customizing it — I didn’t write the highlighter and don’t know the CSS that well.

      As for Akismet, I’m already running that. No spam comments here, although some of the pingbacks might be sketchy. Many are also legitimate though.

  7. Pingback: INFERLab Site
  8. I just installed the very latest WP 3.4.1, brand-new install. Having trouble with SHE, though. If I publish a new post with , it just discards everything between shortcodes and leaves the shortcodes there.

  9. Pingback: ????????? | ??????
  10. Hello there, I am using SyntaxHighlighter Evolved on my buddypress website (http://www.geekclass.it) and i have made some changes in the code to make it bbpress-compatible, so now it works on bbpress forums and group forums in buddypress (if interested in these changes ask via email to info@geekclass.it or look here https://gist.github.com/3768678 in filters in function __construct()).

    Anyway, actually I have an issue that i can’t fix: SyntaxHighlighter Evolved changes double quotes and other symbols with their html codes like &quotes and &gt and so on in both bbpress forum and buddypress groups forum but, strangely, not in post and comments…I am still trying to subscribe to WordPress Codex to ask there but i can’t (don’t know why). Can i find help here? Thank you very much.

  11. is there any way, how i can run it on my web for all WITHOUT loading all brushes? I got from previous CMS the standard syntax of this highlighter:

    something

    so i would like to load PHP brushes when needed, css brushes when needed etc.

      1. ups, the code i wrote disapears. I mean:

        i got from previous CMS this code
        [pre class="brush: php"] some code [/pre] (replace [pre] with standard pre tag). So i would like to apple highlighter automaticaly on those pre tags with proper brush class

  12. How can I display the code with tag ?
    for example this code:

    counter[c]++;
    

    It will display as
    counter1++;

    the tag also has this problem.

    counter[php]++;
    

    also will become
    counter1++;

    the first one will be used in many code… could you tell me how to solve this problem?

  13. I noticed a validation issue with the plugin that appears in your site as well.
    Error Line 66, Column 87: Bad value syntaxhighlighter-version for attribute name on element meta: Keyword syntaxhighlighter-version is not registered.

    …d=”syntaxhighlighteranchor” name=”syntaxhighlighter-version” content=”3.1.3″ />

    My guess is that it is the content tag and the error massage is just unclear in the validator

    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.viper007bond.com%2Fwordpress-plugins%2Fsyntaxhighlighter%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

  14. I’ve been using this for a while. I removed all my posts because of spam and just recently re-published them. For some reason now it’s taking all of my quotes and changing the to html. &quote; etc… wth?

Leave a Reply