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:
- Download from WordPress.org (272,481 downloads)
GitHub:
This plugin is available on GitHub. Issues, patches, and pull requests are welcome.
Can I use this plugin with Disqus and highlight syntax in disqus comments.
Of course not…
?????! ???? ???????? ?????????! ?? ?????? ??? ?? ??????? ????????? ??? ???????????? ???? ???? ???????
Excellent plugin!
Very cood! Thanks. I’ll be using this plugin for my site.
Running trunk, this plugin is causing slashes…
http://make.wordpress.org/core/2013/02/17/slashing-insanity/
http://core.trac.wordpress.org/changeset/23416
Jake
Yeah, known issue (I’m running trunk here on this blog). I just haven’t had a chance to investigate yet.
This was fixed in the latest release by the way.
Great, updating…
So I’m loving the addin, but can’t figure out how to get it to work properly. I’m self-hosting WP 3.5.1 with the Responsive theme and SyntaxHighlighter, and am posting VB code samples (for instance http://www.i-teach.nl/site/uncategorized/test-code-sample/). The code sample box and the line numbers appear, the font is monospaced, but the color-coded syntax I see in all the (HTML/PHP) examples doesn’t appear; all my code remains stubbornly black. Is it something I did, or does VBA not color-code the syntax?
Hi, I had an issue with your plugin (no more highlighting) and I found this answer on WP support forum that solved my problem, do you know why this bug is still there? (The post was 10 months ago):
*****The post that solved my issue on WP support forum*****
The highlighter CSS files are not loading because of a JavaScript error.
I fixed it by editing syntaxhighlighter.php (v3.1.3):
change line 634 from this:
document.getElementsByTagName(“head”)[0].insertBefore( corecss, document.getElementById(“syntaxhighlighteranchor”) );
to this:
document.getElementById(“syntaxhighlighteranchor”).appendChild(corecss);
and uncomment line 648 and delete line 649 so that you are left with only this:
document.getElementById(“syntaxhighlighteranchor”).appendChild(themecss);
Thanks in advance!
Oh…. I saw that Floris Kleijne has also the Responsive Theme.
My config is:
WP 3.5.1
Responsive Theme 1.9.3.1
SyntaxHighlighter Evolved 3.1.6
Running on self-hosted Gentoo VM.
Thanks for the tip, Nicolas! I made the changes as you posted them; sadly, it doesn’t make any difference. In fact, I’m now discovering that the color-coding doesn’t works on any language (tried php, vb) or under any theme (tried Bombay, Citrus Mix; all code shows up black; under Bombay, vb even disappears entirely; under Citrus Mix, no box even).
Hi, Im using your plugin on my wordpress site and find that the tags are displayed as well.
I found out that I need to define stripBrs to true (as stated on http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/) and did so using the following:
or .
This did not work as expected. Could you please advice me on how to “fix” this issue?
Extra info:
WordPress 3.5.1.
SyntaxHighlighter Evolved Version 3.1.6
Many thanks in advance.
Thanks a lot. makes my work so much easire. But there is a lot of stuff in the comments here. You should Separate pingbacks, replies and comments with tabs if possible.