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 (271,511 downloads)
GitHub:
This plugin is available on GitHub. Issues, patches, and pull requests are welcome.
very nice plugin thank you! will definitely use it on my blog.
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?
I’m experiencing the same exact thing after updating to the latest version of the plugin.
Hmm, that’s not good. I’ll check it out.
I have an issue, that is many white line added before my scripts.
You can see at http://techblog.vn/lap-trinh-vien/php-gui-sms-brandname-1sms-vn-958/
Please tell my why and how to fix.
Thanks and best regards.
If you’re sure it’s not like that in the post editor, then try disabling some other plugins. One of them must be causing the issue.
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.
The plugin stores the code encoded. If you disable the plugin, then nothing bad will happen.
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!
This would be best:
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?!
oops! My theme footer hadn’t code below:
Thanks for your amazing plugin!
Yep, that’s a required theme hook.
Glad you got it sorted out.
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:
Sounds like a CSS issue maybe with your theme. Try temporarily switching to the default theme.
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!)
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.
WOW amazing plugin, I also featured this plugin in my site.
Great plugin..
but very complicated to add your own brush, I found one for apacheconf/htaccess here : https://gist.github.com/1048123
Maybe you could add it to your next release
“Very complicated”? It’s super simple. I even wrote a guide: https://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/adding-a-new-brush-language/
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.
Nevermind. I’m pretty sure this is due to problems in the Quercus (Caucho’s PHP implementation) container.
Hello Alex, I have a problem with the plugin SyntaxHighlighter Evolved. I updated WP to 3.4.2 along with other plugins, and suddenly I SyntaxHighlighter more color code. There are conflicts with some plugins?
at this link you can see the error:
http://www.laboratoriocss.it/eliminare-lo-spazio-tra-gli-elementi-in-display-inline-block.html
Thank you.
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 "es and > 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.
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.
My plugin already does that. It only loads the brushes you actually used.
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
How can I display the code with tag ?
for example this code:
It will display as
counter1++;
the tag also has this problem.
also will become
counter1++;
the first one will be used in many code… could you tell me how to solve this problem?
It’s in Version 3.1.3
I am so sorry that it should be
“How can I display the code with tag [ c ] ?”
“the tag [ php ] also has this problem.”
(erase the space)
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
Hi
I am getting issue..
I use SyntaxHighlighter Evolved.. and use below way to format code:-
Or
Issue:-
It insert unwanted span tag in code in IE 8.0 browser, it works in chrome and Firefox.
Could you please help me?
Url: http://sharepoint.infoyen.com/2012/06/16/custom-timer-job-in-sharepoint/
Thanks!
Avinash
byinfoyen@gmail.com
i use like this
”
[/sourcecode]
Hi guys,
Its being 1month. I am still getting same issue..
I use SyntaxHighlighter Evolved.. and use below way to format code:-
[/sourcecode]
Issue:-
It insert unwanted span tag in code in IE 8.0 browser, it works in chrome and Firefox.
Could you please help me?
Url: http://sharepoint.infoyen.com/2012/06/16/custom-timer-job-in-sharepoint/
Thanks!
Avinash
byinfoyen@gmail.com
Hello, Alex! There is Russian translation for SyntaxHighlighter Evolved: http://zalil.ru/34095727
Thanks ,Because i was searching such kinds of plugin’s for my blog.
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. "e; etc… wth?
Cancel that.
It works. Just something with that one post.. not sure what it was, fixed it though. Nice plug in. Thanks!
Perfect, just what I was looking for…