Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Release: [WordPress Plugin] SyntaxHighlighter Plus

This plugin is no longer being maintained, please check out Viper007Bond’s SyntaxHighlighter Evolved instead.

Latest version: v1.0b2 [2009-03-02]

As part of the ‘house-warming party’ (for the (re)launching of the website) gift, I now announce the immediate availability of SyntaxHighlighter Plus. :-)

The official WordPress plugin page is located here: http://wordpress.org/extend/plugins/syntaxhighlighter-plus/

What is SyntaxHighlighter Plus?

SyntaxHighlighter Plus is a WordPress plugin for code syntax highlighting. It is an enhanced version of the original SyntaxHighlighter by Matt, Viper007Bond and mdawaffe. Please give them a big applause for making such a great plugin!

Features of SyntaxHighlighter

SyntaxHighlighter allows you to easily post syntax highlighted code all without loosing it’s formatting or making an manual changes.

It supports the following languages (the alias for use in the post is listed next to the name):

  • Bash — bash, sh
  • C++ — cpp, c, c++
  • C# — c#, c-sharp, csharp
  • CSS — css
  • Delphi — delphi, pascal
  • Diff — diff
  • Groovy — groovy
  • Java — java
  • JavaScript — js, jscript, javascript
  • Perl — perl, pl
  • PHP — php
  • Plain text — plain, text
  • Python — py, python
  • Ruby — rb, ruby, rails, ror
  • Scala — scala
  • SQL — sql
  • VB — vb, vb.net
  • XML/HTML — xml, html, xhtml, xslt

This plugin uses the SyntaxHighlighter JavaScript package by Alex Gorbatchev.

What is the difference between SyntaxHighlighter and SyntaxHighlighter Plus (prior to v1.0)?

SyntaxHighlighter Plus is built upon SyntaxHighlighter with extra features and bug fixes. In addition to the original version, SyntaxHighlighter Plus has the following extra goodies:

New in SyntaxHighlighter Plus v1.0 !

Starting from SyntaxHighlighter Plus v1.0, the core engine is upgraded to
Alex Gorbatchev’s SyntaxHighlighter 2.0!

New features since the 1.5 engine:

  • CSS Themes
  • Line highlighting
  • HTML with script tags
  • Smart line wrapping
  • No-CSS fallback
  • Strict & XHTML compliant
  • Inline URL detection

Click here to view the complete version matrix.

Is SyntaxHighlighter Plus backward compatible?

Yes! Simply replace the original SyntaxHighlighter files and that’s it! Start from version 0.13, the plugin folder was renamed to ‘syntaxhighlighter-plus’.

How to install and use this plugin?

Please refer to SyntaxHighlighter’s project page.

Examples

The examples are using the RDark theme.

PHP

	function BBCodeToHTML( $content ) {
		if ( !$this->CheckForBBCode( $content ) ) return $content;

		$matches = $this->GetBBCode( $content );

		if ( empty($matches) ) return $content; // No BBCode found, we can stop here

		// Loop through each match and replace the BBCode with HTML
		foreach ( (array) $matches as $match ) {
			$language = strtolower( $match[4] );
			$content = str_replace( $match[0], '<pre class="syntax-highlight:' . $language . "\">" . htmlspecialchars( $match[5] ) . "</pre>", $content );
			$this->jsfiles2load[$this->languages[$language]] = TRUE;
		}

		return $content;
	}

CSS

.dp-highlighter
{
	font-family: "Consolas", "Courier New", Courier, mono;
	font-size: 12px;
	background-color: #E7E5DC;
	width: 530px;
	margin: 18px 0 18px 0;
	padding-top: 1px;/* adds a little border on top when controls are hidden */
	overflow: auto;

	/* fixes for IE: "overflow: auto" causes unnecessary vertical bar */
	/* corrects bottom scroll bar overlapping */
	overflow-y: hidden;
	padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);
}

Syntax

Bold ones are exclusive to SyntaxHighlighter Plus. Furthermore, quotation marks around the language can be omitted.

  • [source language=’css’] … [/source]
  • [code language=’css’] … [/code]
  • [sourcecode lang=’css’] … [/sourcecode]
  • [source lang=’css’] … [/source]
  • [code lang=’css’] … [/code]
  • [sourcecode=’css’] … [/sourcecode]
  • [source=’css’] … [/source]
  • [code=’css’] … [/code]
  • [lang=’css’] … [/lang]
  • [css] … [/css]

License

GNU Lesser General Public License (LGPL)

Changelog

v1.0b2 [2009-03-02]

  • Upgraded SyntaxHighlighter to 2.0.296
  • Added automatic SSL detection (thanks to g30rg3_x)
  • Added anti-XSS and XSRF (thanks to g30rg3_x)
  • Language aliases fix
  • Code clean up

v1.0b1 [2009-02-07]

  • Upgraded the core engine to SyntaxHighlighter 2.0
  • Added configuration: themes
  • Default language changed from PHP to plain text

v0.18 [2008-07-19]

  • Added PHP as the default language if no language is specified (e.g. [ code ][ /code ])

v0.17 [2008-06-28]

  • Fixed a bug in the Bash highlighting code which caused conflicts between keywords and variables highlights

v0.16 [2008-06-02]

  • Ported SyntaxHighlighter 1.1.1 changes: ‘Encode single quotes so wptexturize() doesn’t transform them into fancy quotes and screw up code.’

v0.15b [2008-05-07]

  • CSS fixes for IE6

v0.15a [2008-05-07]

  • Enhanced CSS

v0.15 [2008-05-01]

  • Fixed the IE scroll bar issue (backup your CSS file before upgrade!)

v0.14 [2008-04-22]

  • Added support for Bash (thanks to Nick Anderson)
  • Now supports WordPress MU (thanks to Tim)

v0.13 [2007-12-19]

  • Changed plugin folder to ‘syntaxhighlighter-plus’.

v0.12 [2007-12-18] – Broken!

  • Appeared on the WordPress plugins site.
  • Fixed readme.txt.
  • Cleaned up the files.

v0.11 [2007-12-16]

  • Added more syntax variants.

v0.10 [2007-12-16]

  • Initial release.

Download

v1.0b2 WordPress Official Mirror
v1.0b1 WordPress Official Mirror
v0.18 WordPress Official Mirror
v0.17 WordPress Official Mirror
v0.16 WordPress Official Mirror
v0.15b WordPress Official Mirror
v0.15a WordPress Official Mirror
v0.15 WordPress Official Mirror
v0.14 WordPress Official Mirror
v0.13 WordPress Official Mirror
v0.12 WordPress Official Mirror
v0.11 WordPress Official Mirror
v0.10 WordPress Official Mirror

  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , , , ,

Comments Section

212 Responses to “Release: [WordPress Plugin] SyntaxHighlighter Plus”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    Hello Fred,

    First off, thanks for updation, I hope this’ll work with WordPress 2.3.x. As, the original SyntaxHighlighter plugin didn’t worked for me.

    Well, I’m using Amit’s IG-SyntaxHighlighter for the past 2+ years. And has alot of code, just wanna ask you, can you add an additional syntax variant: [lang][/lang] e.g.

     

    . This will help in migrating from ig-Syntax to SyntaxHighlighter without loosing previously saved codes.

    Expecting some response at the earliest possible.

    DG…

  2. 2

    Hi DG,

    Interesting, because I used the original SyntaxHighlighter with 2.3.1 and it was fine. Perhaps you have some other plugins that conflict with it?

    As for more variants, I’ll see what I can do. :)

    Cheers

  3. 3

    Hi Fred,

    Thanks for the prompt reply. Eagerly waiting for your input on the requested variant.

    2. I’ve notice your blog loading quite fast, even with lots of JS. Are you using any server side cache?

    Also, very important, you plugins directory is open for public view, just disable it.

    DG…

  4. 4

    DG, I have updated the plugin, it now supports [lang] and ,etc. :)

  5. 5

    Regarding the loading speed, yes I’m using WP Super Cache.

    In the next few days I’ll compose an overview of some of the ‘essential’ plugins.

    Cheers

    P.S. Thanks for the heads up on the directory security concern. :)

  6. 6

    Hi Fred,

    Thanks once again, just dowloaded upgraded version.

    2. I saw Super Cache initially, Donnacha has done a fantastic work.

    3. Re. essential plugins, I hope, you’ve your compilation, incase if you want, you can check this post of mine.

    Thanks again for the help and prompt reply’s.

    I’ll tag your post tomorrow on my blog.

    DG…

  7. 7

    You’re welcome DG. Wow you have a big list there, I’ll ‘study’ it soon. :)

  8. 10

    How do you do it with whitespace? Mine seems to be eaten by WordPress the whole time (everytime the post is saved). Is there any trick to this?

  9. 11

    Adam, do you have any other plugins installed that may cause this? Some text formating plugins might trim the whitespaces.

  10. 13

    LOL, good stuff ! Love reading your blogs.

  11. 14

    Nope, nothing like that. Are you editing your posts in HTML or in the “WYSIWYG” editor?

  12. 15

    Adam, I do all posts using the good ol’ raw, plain editor. ;) Never used the WYSIWYG editor, now that I think of it, it might be a cause if you use that in combination with the syntax highlither. I will do some tests later. :)

  13. 16

    Admin I just tested it and unfortunately the WYSIWYG editor doesn’t like the plugin. There is no way around it I’m afraid…

  14. 17

    Well, maybe I’ll just use that too. Never trusted the WYSIWIG editor completely anyway. It’s just that I always think that it’s a nice feature and I always try to use nice features naively hoping they make things better. And sometimes these features aren’t exactly what I need/want, as in this case.

    Thanks for all the help!

  15. 19

    really a great plugin. I do a change that the “files” folder to “shlfiles” for wordpress mu edition. because the “files” conflicts with the user-upload-file-folder in wordpress mu . please review my article http://tim.diary.tw/2008/03/05.....hter-plus/
    please give some advise and merge to your version for wordpress mu version. thanks a lot!

  16. 20

    Thanks Tim, I will merge this feature in the next few days. :)

  17. 21

    you’re welcome, thanks for your reply and enhance this plugin…

  18. 22

    Hi Fred,
    can your plugin be used to highlight code posted in the comments?

  19. 23

    @Claudio: Yes you certainly can! :) At around line 58 of syntaxhighlighter.php, you will see the following comment:

    // Uncomment these next lines to allow commenters to post code

    Just uncomment the three lines after that to allow syntax highlighting in comments! :)

  20. 24

    Thanks Fred, this plugin is awesome!

  21. 25

    really a great plugin.

  22. 26

    Automatic newline ?

  23. 28

    Any chances to make it work with 2.5?
    Thanks!

  24. 29

    Hi Moshu, did you find any particular function broken in 2.5? I am running 2.5 here and the plugin appears to be working fine.

  25. 31

    v1.3,v1.4 still have problem on WP 2.5

    it convert line break to “” text and it convert on each line……

    for example:
    http://blog.miawork.com/?p=654

  26. 32

    @Ming: Did you use the WYSIWYG editor? If so that is the reason why it converts line breaks, there is currently no workaround unfortunately.

  27. 33

    Re: Fred Wu
    Yes, i using the WYSIWYG editor come with WordPress.

  28. 34

    @Ming: Unfortunately WYSIWYG messes up the syntax highlighter code, your only option is to switch to the plain editor for the time being.

  29. 35

    Hello,
    Thanks for your great plugin. I’ve been using it for months. Now the syntax on my blog shows twice when I use this plugin, but it’s normal without [lang]. I just find this probelm and it may caused by the compatibility with WP 2.5. I had no probelms before.
    Thx

  30. 36

    @Greenmoon55: I cannot reproduce the problem. Are you saying that the code will appear twice if you use the [lang=php] format?

  31. 37

    I use [lang='pascal'][/lang]. It looks like this: http://greenmoon55.cn/blog/broken-necklace/
    I guess that it’s not caused by [lang='pascal'][/lang]. I tried to use format but problem was not solved.
    Sorry for my English. I’m learning English now. Thx.

  32. 38

    @Greenmoon55: It works fine here, could you please provide me a list of your activated plugins? Maybe one of your plugins is interfering with it.

  33. 39

    I use common plugins. I tried to deactive all and keep this one actived, nothing changed. I’ve updated to 0.15.

  34. 40

    @Greenmoon55: I just re-analysed your page source and noticed that the SyntaxHighlighter Javascript has been inserted twice.

    Search for ‘SyntaxHighlighter Stuff’ in your HTML source and you’ll see what I mean. Please double check your templates to make sure that only one instance of the script is included.

  35. 41

    Thanks for your help. I changed to another theme, then it has no problem. But I don’t know why. I don’t want to change the theme.
    Could you tell me more about how to find the problem in the theme files?

  36. 42

    I suspect the SyntaxHighlighter scripts are somehow hard coded into your theme. If that’s the case then please search and remove it. Otherwise you could email me the theme files to canglan [AT] gmail.com and I’ll take a look at it for you. Cheers

  37. 43

    I’m having a bit of trouble with the syntax highlighter; it works great, except comments have a large, visible box around each line. See the code near the bottom of http://www.coriolinus.net/2008.....thats-why/ . I suspect that this is due to a CSS conflict, but I’m new to WordPress and I have no idea how to begin debugging this.

  38. 44

    I have some problems with your highlighter code, I am running WP 2.5, and using Mandigo theme. I have installed the latest version of you app, but the output looks funny:
    http://www.xipher.dk/WordPress/?page_id=170
    It seems to indent some lines, and not others.
    I have tried switching to the WordPress default 1.6, but it still has issues, do you have an idea what could be happening here ?

  39. 45

    Claus, the page you linked is empty.

  40. 46

    Sorry I had accidently marked it as private, and FF had kept my login credentials… So I could see it…

    It should work now, and sorry for the trouble :)

  41. 47

    Claus and coriolinus, please upgrade to version 0.15b, it should fix both of your CSS problems.

  42. 48

    Thank you for your quick reply.

    It seems to have fixed most of the problems.. Now every other line of code is indented.

    http://www.xipher.dk/WordPress/?p=168

    PS I know it is “unsupported” code (PowerShell), but that should not cause the problem should it ?

  43. 49

    Claus: I’ve fixed this in SVN trunk. You may get the file directly at: http://svn.wp-plugins.org/synt.....ighter.css

  44. 50

    Thank you, that’s fixed it. Good plugin!

  45. 51

    Thank you very much it works now :)

  46. 52

    I’ve send the theme files to you. Thank you.

  47. 53

    Problem solved. Thx for your help.

  48. 54

    I am trying to post some actionscript code that contains what wordpress thinks are invalid XHTML. I have tried to work around this by replacing the angle brackets with entity references but they don’t render correctly. What is the solution for using entity references within SyntaxHighlighter?

  49. 55

    Brett, would you mind posting a link or some samples here?

  50. 57

    Since I update to wp v2.5.1, my highlighter broke, among other things. Installed your plugin and for some reason the js isn’t loading, so I end up with the tags printing on screen. I’m kinda desperate, because all the highlighter plugins I’ve tried so far don’t seem to work.

    link: redivide.com[...]vhost

    Using [lang=’xml’]…

  51. 61

    Hi, Thanks for this wonderful plugin, however I am experiencing one tiny error. The output print double if , as you can see in http://tajidyakub.com/2008/06/.....n-the-fly/ , but if we copy to clipboard the double if disappeared. I wonder where it went wrong?, I use sourcecode lang bash and bash /bash, same thing happen. Thanks again.

  52. 62

    Hi Tajid, I have updated the script to 0.17 which should fix this problem. Please give it a try. :)

  53. 63

    Hi Fred, Thanks for the update, it works .. :)

  54. 64

    Anyone has the problem where the spaces/tabs gets “eaten” up? I am loosing all my indentations. I typed in spaces but after hitting “Save”, the spaces gets “eaten”.

  55. 65

    Hi Fred,

    We talked during the inital release of Syntaxhighlighter Plus. May I request you add a Syntax

    ..some code..

    , because I’ve lots of codes wrapped in the above noted syntax variant during my “IG-SyntaxHighlighter” usage, now those code are broken.

    Hope for an early reply.

    Thanks,

    DG…

  56. 66

    not work for me :(
    http://toplez.textdriven.com/?p=3

  57. 67

    thx.. it work now :)

  58. 69

    Excuse me, I have to trouble you again.
    I’ve just changed a new theme but found that the first line of my code isn’t shown correctly while the other lines work well.
    Can I send you my theme and you help me? This theme author is popular in China. He has made many good themes. Many people use this one.
    Thank you!

  59. 70

    For example http://greenmoon55.cn/blog/the-castle/
    Luckily, this is not a serious problem like last time.

  60. 72

    thank you ^_^

    i have problem with Arabic language – right to left language -
    and the code appear in right to left
    see here
    http://www.islamcg.com/blender/?p=65

  61. 75

    @Derick: What version of WordPress and SyntaxHighlighter Plus are you using? And are you using the WYSIWYG editor?

    @DG: This feature is now included in 0.18. :)

    @Greenmoon55: In your main CSS file, the definition of .comment is conflicting with the SyntaxHighlighter CSS. You could either make that definition more specific, or manually set the .comment in the SyntaxHighlighter CSS to have no float, etc.

    @ibnyassen: You blog is showing the WordPress error page.

  62. 77

    Right now I’ m using WordPress 2.6 but it didn’ t work either with 2.3.x nor with 2.5.1, and yes, I’ m using the visual editor…
    As regards SyntaxHighlighter Plus I’m using 0.18, but neither 0.17 worked, in every kind of combination with WordPress versions.

    Another problem is the conversion of special chars, such as: “&”, “>”, “<” and ” “…they just appear in the article like “ ”, “>”, “<” and so on…I really need this fantastic plugin to work properly!

    Bye, Derick

  63. 78

    Hi Fred,
    first of all I want to thank you for this awesome plugin, very very useful..

    I’ ve got the SAME, IDENTICAL problem Derick has:

    1) Indentation not working properly

    Moreover, I’ ve got an issue with “”, ” ” and “&” chars decoding; they don’ t appear as they should.

    I’ m using latest versions both of SHP and WordPress (2.6) with a visual editor. It seems everyone knows the problem is in the WYSIWYG editor, but noone knows how to fix it!

    Hope you have a solution for both my problems!

    Goodbye, Nicola

  64. 79

    Ok, I think you’ ve understood which are the chars I meant..your comment editor just converted them!
    (They are “greater than”, “less than”, “space” and “ampersand”)

  65. 81

    I suggest that change ‘width: 530px;’ in line 6 of css file to ‘width: 100%’ to adapt various width of theme.

  66. 85

    Hey Fred,

    Great plugin just one problem when i use the & in a piece of bash code it gets changed to & and every edit an amp; gets added very anojing also the & shows up as & instead of &….

    [mad]Berry

  67. 86

    Found another little problem wit the following post
    http://madberry.org/2008/08/do.....with-wget/

    The line:
    wget –wait=20 –limit-rate=20K -r -p -U Mozilla http://myhdwallpaper.com

    In the highlighter became:
    wget –waitwait=20 –limit-rate=20K -r -p -U Mozilla http://myhdwallpaper.come

    For some reason there is an extra “wait” in it the tags used are [/bash]

    Can’t seem to figure out why this is happening. Do you know?

    [mad]Berry

  68. 88

    Works great with one problem. If I use a line of code that begins with < ? p h p (without spaces of course), the entire line disappears.

  69. 93

    Thanks for this. I was looking for a plugin which can make the syntax highlighting in wordpress posts easier.

  70. 94

    This is indeed a nice plugin. However, it does not currently pass a W3C CSS validation test. http://jigsaw.w3.org/css-validator/

    Could you please correct the CSS errors.

  71. 95

    Have you guys tried “EDITING” a previous post only to find your code got all messed up… the site converts certain characters, and when you edit and or manage a post , those weird characters appear..

    Hello world code:
    
    Hello World
    <BODY>
    Hello World.
    

    will be converted into

    Hello world code:&amp;lt;br&amp;gt;
    &amp;lt;HTML&amp;gt;&amp;lt;br&amp;gt;
    &amp;lt;TITLE&amp;gt;Hello World&amp;lt;/TITLE&amp;gt;&amp;lt;br&amp;gt;
    &amp;amp;amp;lt;BODY&amp;amp;amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;&amp;lt;font color=&amp;quot;green&amp;quot;&amp;gt;&amp;lt;H2&amp;gt;&amp;lt;U&amp;gt;Hello World.&amp;lt;/U&amp;gt;&amp;lt;/H2&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;&amp;lt;/BODY&amp;gt;&amp;lt;br&amp;gt;
      &amp;lt;/HTML&amp;gt;

    any help is appreciated.

  72. 96

    Hi,

    I installed it and activated it just like you told on the wp plugin page.
    BUT: it only works right for HMTL.
    When i type in some php code to display it doesn’t post the Post but brings me to a 404 Error page.
    Do you know how to solve this?

    Regards,

    Marcel doornbos
    http://www.marceldoornbos.com/.....-php-site/

  73. 97

    Hi,

    So i found out:
    When i do this code it works:

    
    

    And when i do this one with a little line extra it doesn’t work:

    
    

    Tell me what’s wrong?

  74. 98

    Hi, what a great plugin. I just miss one thing. Is it possible if i like to publish just a part of the source code, that i can set the start of the line number?

  75. 99

    I tried Syntax Highlighter plus, but it is not working. what may be the problem
    http://www.codemator.com/2008/.....-response/

  76. 102

    I agree with post #65, the width in the CSS should be changed to 100% for people who don’t use the standard wordpress width.

  77. 103

    hi, how to change the SyntaxHighlighter window size to a smaller?

  78. 104

    Hi I m glad to your post “: [WordPress Plugin] SyntaxHighlighter Plus | Beyond Coding” so well that I like to ask you whether I should translate into German and linking back. Please answer. Greetings Detektiv

  79. 105

    How i chage initial line values ? using the code:

     codes.... 

    example, source code start at line 30, how i show this ?

    Thanks!, i´am using SyntaxHighlighter Plus

  80. 106

    How do i change the initial line value of codes ?

    Example using

     codes... 

    start at line 30…

    I´am using SyntaxHighlighter Plus and my homepage is http://www.thiagomedeiros.com

    Thanks

  81. 107

    Great plugin!
    But I got a problem: There are no line numbers in my code snippets, instead small circles are displayed. Whats wrong here?

  82. 108

    I wrote a plugin that allows code editing in wordpress’s visual editor. http://www.webveteran.com/blog.....de-editor/
    Works great with syntax highlighter plus. But what I cannot figure out is, how do we start the code block on any line number? For instance 742 instead of 1. Any help is appreciated!

  83. 111

    Two bugs:

    Copy to clipboard copies nothing to the clipboard.

    Secondly..if we copy manually, line number also gets copied…which should not be the case.

    This problem occurs both with WordPress 2.6.5 and WordPress 2.7 final also.

  84. 112

    As Navjot Singh said, the copy to clipboard doesn’t work. Not on my site, nor this one. Is it a browser setting or something?

  85. 113

    I really love this plugin, but it would be so much better if there was a tinymce button in the wysiwyg editor.

  86. 115

    You should add this CSS to make it compatible with certain themes (like inove):

    .dp-highlighter ol li
    {
    list-style-position:outside !important;
    }

  87. 118

    I’m loving the plug-in, but I’m having a bit of trouble with the width. It’s just a bit too wide.

    Also, being able to start line numbering at a different number would definitely be nice.

  88. 119

    You may want to get in contact with the developer of the “visual-code-editor” plugin. This plugin resolves the character modification issues that result from using the visual text editor. However, when using this plugin alongside your plugin you are required to make one small modification to your plugin. You must remove the call to htmlspecialchars() on line 331 in order to prevent the special characters from being displayed as their equivalent character codes when viewing the published post.

  89. 121

    Hey, i’m used your plugin , it’s ok. But when I published an article with php code (for example) I have a space between < and ?php. Why? A solution? Thank you

    As soon :)

  90. 122

    I created an AS3 (Flash 10) brush for use with this plugin for anyone interested

    http://blog.coursevector.com/a.....ghlighting

  91. 123

    Hello Fred,
    Thank you for posting this version of the SyntaxHighlighter. While the plugin does what it is supposed to do (highlight code), I find that WordPress insists in displaying the output in just one line. I have tried many different highlighters and the result is the same for me each time. All of my code displays on one single line instead of preserving the formatting of the pasted code into the post editor in WordPress. I am about to go crazy with it. Please, please, please! Let me know how I can get passed this issue. This seems to be working for everyone else and I, for the life of me cannot understand why I get the same result over and over, and over again!

    Thank you in advanced,
    Ramon E. Tristani

  92. 125

    Hi guys, just thought I’d let you know that all of your comments have been looked at and I will be releasing a new version of the plugin soon to address all the issues reported. On a side note, Alex has just released version 2.0 of SyntaxHighlighter. A new version of the plugin based on 2.0 will be released soon unless the ‘donationware’ status prohibits me from releasing it. Thanks guys.

  93. 127

    Hey Fred, for some reason, this plugin doesn’t fully work in my theme. It will change the entities, but it won’t put the code into a list and won’t like the dp-highlighter wrapper. It worked in the classic theme, but not mine. I disabled all my other plugins, but that didn’t seem to help. Any ideas?

  94. 128

    Is it possible to add syntax highlighting for Perl? I put together a Perl brush file and modified version .18 of the plugin to use it, but I’d rather not have to keep making the modification for every new version. I’d be happy to submit the brush file if that helps (though I didn’t spend much time on it). Thanks!

  95. 129

    Hi

    I’ve yet upgraded to latest version but there is something wrong

    1 – the copy feature is not present
    2 – buttons overlay the code

    You can view this here: http://engelium.netsons.org/bl.....i-css.html

    Is this a bug or is there something wrong on my installation?

  96. 130

    Great work by you and Alex, thanks!
    I seem to be getting extra glimpses of the new line wrap icon: http://garyjones.co.uk/blog/pluralization/ – am I doing something wrong?

  97. 131

    Hi Fred – nice work.

    How do enable support for older-style brushes, like ColdFusion? The syntax in the new brush files looks different. And I see a file called ‘shLegacy.js’. But I can’t figure out this puzzle.

    Thanks,
    Jules

  98. 132

    @Stephen: The default set of CSS files don’t reset all of the elements hence why they are not compatible with some themes. Could you please send me a link to the theme or the theme files? Thanks.

    @David: The new 2.0 engine uses slightly different brushes. Would you be able to update your brush to be compatible with 2.0?

    @Engelium: This is the expected behaviour of the new 2.0 engine. I will contact Alex and see if this is something he is going to fix. If not then I will be looking into it. :)

    @Gary: Could be a CSS issue, I will look into this.

    @Jules: Unfortunately all old brushes need to be upgraded to work with the new engine. The shLegacy.js file is for migrating old ‘pre’ tags to the new ones, which is irrelevant to us because the tags are generated by SyntaxHighlighter Plus.

  99. 133

    I misremembered: I had made some other brushes, but the Perl brush was by Marty Kube. I found it here. I will happily update it to work with 2.0, if you like. How should I get it to you?

  100. 134

    Ah dang. That means I cannot even update or test my plugin with yours… I’m all CF.
    I guess I’ll have to update that CF brush eventually :)

  101. 135

    Great Plugin! I just installed it and it looks great!

    I had spent a few hours about a week ago trying to come up with styles to make code look ok — this helps SO much.

    One little question, is I can’t figure out to actually highlight a section of code. Does anyone know how to highlight an entire line, and/or a section inside a line? I like to show readers exactly what part of the code was updated when I can.

    Thanks!

  102. 136

    If also got some problems with the new version and my theme. Look at http://www.kilrathy.net/sites/.....d-new.html and you see what’s the problem… :(
    Hope there is a fix

  103. 138

    Alright, I converted Marty Kube’s Perl brush, and also wrote one for OCaml. They’re here: Perl brush, OCaml brush. For those who want to use them (if Fred doesn’t decide to add them to the default set), you should put the brush files in the scripts directory with the other brushes, and then add the following 2 lines to syntaxhighlighter.php, where it defines $this->aliases in SetVariables:
    ‘OCaml’ => array(‘ocaml’, ‘OCaml’),
    ‘Perl’ => array(‘perl’, ‘Perl’, ‘pl’),

  104. 139

    I am having some trouble adding another brush, I had a few I added to the old version which worked…

    I made changes to a powershell brush, to reflect the new changes, bt I cannot get it to work.
    I uploaded to brush to the \scripts dir with the name shBrushPowerShell.js

    I edited the syntaxhighlighter.php file and added the following line:
    ‘PowerShell’ => array(‘powershell’, ‘posh’, ‘ps’, ‘psh’),

    When I go to my site http://www.xipher.dk I get a popup saying that syntaxhighlighter is not able to find the brush posh or ps.

    I have uploaded the files in .txt here:
    http://xipher.dk/WordPress/wp-.....rShell.txt

    And

    http://xipher.dk/WordPress/wp-.....ighter.txt
    It is probably something stupid I have overlooked, but I cant seem to figure it out.

  105. 140

    Figured it out… I had typed in a couple of variables with capital letters.. It did not like that… Now we only need to get the copy to clipboard thing working :)

    BTW Thanks for a great plugin

  106. 141

    It does not work for me with 2.7.1, when I write something in

     ... 

    tags then save, everything in tags to be cleared.
    how can I fix that ?

  107. 142

    I have a suggestion: instead of manually entering the languages and their aliases in a big array, why not have syntaxhighlighter.php grep through the scripts directory, finding all the brush files and the line of javascript in which they specify the language’s alias. That way, if people want to add support for a new language, all they have to do is drop the appropriate brush file in the scripts folder, and it’ll automatically be supported. Here’s some code to do it:

    replace $this->aliases = … with:

    $aliases_js = array();
    $aliases = array();
    $aliasgrep =
    ‘cd ‘ . ABSPATH . PLUGINDIR .
    ‘/syntaxhighlighter-plus/syntaxhighlighter/scripts/; ‘ .
    ‘grep -P “SyntaxHighlighter\\.brushes\\.\\w+\\.aliases” *;’;
    exec($aliasgrep, &$aliases_js);

    $regex = ‘/brushes\.(\w+)\.aliases\s*=\s*\[\'(.*)\'\];/’;
    foreach ($aliases_js as $a_js) {
    preg_match($regex, $a_js, $matches);
    $aliases[$matches[1]] = preg_split(‘/\’,\s*\’/', $matches[2]);
    }

    $this->aliases = apply_filters( ‘agsyntaxhighlighter_aliases’, $aliases );

  108. 143

    By the way, I get an unusual error every time I try to submit a comment. A broken image appears next to the “submit comment” button, and then I get an error popup (looks like a javascript alert), and the page fails to reload. If I manually reload the site, everything’s fine, but it’s unsettling because my comments usually don’t show up immediately, and there’s no feedback to say that the error didn’t prevent my comment from going through.

  109. 144

    The error is:

    “ACP error!

    TypeError: Undefined value”

    Sorry for all the repeated comments.

  110. 145

    I commented on this before, but it apparently didn’t go through (maybe wordpress didn’t appreciate all the php code).

    I have a suggestion: instead of manually entering the languages and their aliases in a big array, why not have syntaxhighlighter.php grep through the scripts directory, finding all the brush files and the line of javascript in which they specify the language’s aliases. That way, if people want to add support for a new language, all they have to do is drop the appropriate brush file in the scripts folder, and it’ll automatically be supported. I have written the code for this, but it seems I can’t successfully submit it in a comment.

    Fred, you don’t have any contact information anywhere. Would you like me to send you the code? If so, how can I get it to you? Thanks!

  111. 146

    The new version (1.0b1) doesn’t work properly – it displays all the “greather than” signs as HTML entities. I’ve reverted to version 0.18 which works fine.

  112. 147

    Here’s another test case for Python:

    data = urllib.urlopen(’http://airnow.gov/index.cfm?action=airnow.showlocal&amp;cityid=164′).read()
    re.findall(’&lt;table .*?AQI observed at (.*?):&lt;.*?<b>(.*?)</b>.*’, data, re.S|re.S)[0]
    

  113. 148

    I would first like to say thanks for the +PLUS version of SyntaxHighlighter as it has been extremelly useful to me for the 6+ months I have been using it. The additions of bash and plain text are things I use all the time.

    I am however having the same issues with the latest upgrade. Specifically a lot of the code I am posting is one off stuff where it may be one line of CLI from Linux thus the icons are falling over the top of over 50% of the code I am posting. I also do miss the “copy to clipboard” feature in previous versions.

    For now I have downgraded back to an easrlier version (appears to be really early 0.18) but regardless I appreciate the plugin and look forward to future releases. I am also going upgrade to the release right before 2.0.

  114. 149

    Hi,

    @David: Your feature proposal sounds great… but your implementation is so awful :-/.

    First…
    It relays on specific-environments limitations (grep is for unix-like only)

    Second….
    Some hosting environments does not like the idea of giving you the power to do system calls…

    And Third…
    Scanning the directory every time the plugin is called, would cause a performance hit against your wordpress-powered-site, for the simple reason that it has to re-scan every time just for looking “if you have changed or added a new aliases”… even that the data can be cached on the DB, you have to agree that there are other ways to solve the problem.

    IMHO,
    The big aliases array is a great idea, since the aliases-scripts aren’t going to change ( of course: not unless fred want’s ;) ), but we can actually instead of making the david-proposal, fred can just put/add a plugin-hook were other developers can relay to add the aliases they want (the david-proposal actually implements this idea but for other reasons and more limitated)…
    Some plugins out there are actually using this concept/approach cause sometimes you want more than the default behavior of a plugin and giving hooks to developers would be easy to maintain and also this way would not affect the plugin performance.
    If i find some free time over the week, i would send a patch-proposal to fred which will implement this idea/concept to the plugin with -of course- a example of how to use it.

    Best Regards

  115. 150

    I’ve just started using this and have encountered a couple of problems:

    1. I’m also using the Exec-PHP plugin in posts and sometimes the PHP is being parsed and screwing with the post being retrieved. I have to put a space between < and <?php to get it to work.

    2. On one post that has code blocks in HTML, CSS & js, the HTML & CSS code blocks come out fine, but when I wrap the js code block in any kinda of tag, the whole content of the post gets eaten!

  116. 151

    Good work! Just one note, PHP5 is required for this plugin to work.

  117. 152

    Hi!
    I’m also using this plugin, but I’m having problems with indentation: it seems all spaces and tabs are being “eated”…how can I fix this?

  118. 153

    Great plugin but I have one problem. The plugin separates < and ?php when it should be <?php.

    Any help on this issue would be great :)

  119. 157

    Hello,

    I have been using this plugin from quite while. Today, i happened to validate my blog using HTML Validator.

    I see that your plugin adds link tags in the header section. HTML rules says for link tag /> is enough </link> gives html validation error. Can you change this in your next release?

  120. 158

    Nice plugin and seems to be popular so I’ll try it out

    I’m about to install it on my blog at http://www.webtechglobal.co.uk/?page=df/blog

    I should need it for all languages over next couple of years so fingers crossed its the number 1 solution eh!

  121. 159

    Oh well seems like another failed plugin!

    When trying to use the code wrap syntax and update I get the following…

    Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in /home/sites/webtechglobal.co.uk/public_html/blog/wp-includes/compat.php on line 105

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/webtechglobal.co.uk/public_html/blog/wp-includes/compat.php:105) in /home/sites/webtechglobal.co.uk/public_html/blog/wp-includes/pluggable.php on line 850

  122. 160

    Hey guys, great job on the plugin! I really like the results from it. Best syntax highlighter I’ve found.

    Running into two minor issues.

    When documenting a redirect in bash (>>) it is displaying as >> in the code block.

    Also, the line numbers are offset from the code by about a half line.

    Example here: http://jts-blog.com/?p=30

    Suggestions? Thanks!

  123. 161

    woops, in my last comment should be “>> is displaying as & gt ; & gt ; ” without the spaces) My text was auto-converted to >>

  124. 162

    Nice highlighting plugin. I have used i at bit, and is trying different ways of blogging. I’m getting pretty fond of the XML-RPC way of posting, unfortunately when using any of the bracket solutions like

     ... 

    while this is not html, then the content will almost always be interpreted in a wrong way by the XML-RPC enabled editor.
    A solution would be if it was possible to use the “old” syntax of the original syntaxhighlighter … . I tried this of course, but i get a warning that the brush could not be found.

    Otherwise it’s a really nice integration of syntax highlighting in wordpress, a big thanks! :-)

    On a side note, is it possible to add a check box to the configuration page to dis/enable the copy to clipboard icon?

    Regards, Esben

  125. 164

    Hi Fred,

    Can you add a lang ‘

    ....

    ‘. I’ve lots of data wrapped between “

    ...

    “. When I was using ig-syntax highlighter plugin.

  126. 165

    Hi Fred,
    In my website, the code is not coming as perfect as it is here.
    The line numbers are overlapping the code, spaces are becoming line breaks.
    I am using Text editor.

    Please help me :(

  127. 168

    Hey. Is there any way to enable the copy to clipboard links?

    This would be most appreciated.

    Thank you.

  128. 169

    Also, do you know of any reason why this would cause some jQuery stuff (lavalamp, slideshow, etc) to fail, but only in google chrome?

    Any help would be appreciated.

  129. 174

    Hey,

    I installed Syntax Highlighter Plus and it seems to work correctly (ie. it adds the pre tags around the code) but it doesnt add the css styles to the page. Any ideas?

    Cheers

  130. 180

    please put actionscript 3 in there

Trackbacks

  1. SyntaxHighlighter Plus WordPress Plugin » D' Technology Weblog: Technology, Blogging, Tips, Tricks, Computer, Hardware, Software, Tutorials, Internet, Web, Gadgets, Fashion, LifeStyle, Entertainment, News and more.
  2. My favorite WordPress plugins at Guy Lewin
  3. Wordpress Plugins Recommendation List | thislab
  4. Web Tech Daily » Blog Archive » List Of Useful WordPress Plugins
  5. SyntaxHighlighter Plus Patch | cmdln.org
  6. SyntaxHighlighter Plus: Now Supports Bash and Wordpress MU | thislab.com - Web development and design by Fred Wu.
  7. Shibing’s Blog » Blog Archive » 终于…. ^_*
  8. Shibing的博客 » Blog Archive » 终于完成…. ^_*
  9. Dipslaying Code In WordPress Posts | Theme Lab
  10. ConstantConfusion » Blog Archive » SyntaxHighlighter Plus
  11. Deployment and configuration of wordpress blog engine - my impressions : Anton Gochev’s Weblog
  12. ColdFusion syntax highlighting in Wordpress : On the Bubble
  13. testwordpress - トラックバック企画
  14. wordpress code snippet 문제점
  15. The Definitive Guide on Wordpress Syntax Highligher Plugins - Cagintranet Web Design
  16. Eingesetzte Wordpress Plugins | FortyTwo
  17. Подсветка программного кода в постах (для Wordpress) :: Tod’s Blog
  18. Syntax Highlighters for Wordpress » ryan blog
  19. YIN-YIN LE BLOGMASTER || Syntaxhighlighter
  20. Mi Blog 0.1 | PHP, MySQL, JavaScript, CSS
  21. Diskurswelt.de Archiv » Diskurswelt Setup
  22. Подсветка программного кода в постах — За рублём
  23. Sedikit Cerita Dari Gw » Plugin Wordpress SyntaxHighlighter Plus
  24. Development memo » syntaxHighlighter-plusのプラグイン
  25. How to Beautify Code samples in your post using Syntax Highlighter | Nihar's World
  26. forea.ch() » Blog Archive » AS3 brush (shBrushAS3.js) for SyntaxHighlighter-Plus
  27. Welcome… | tail -f /dev/null
  28. code» ブログアーカイブ » ソースコードの色分け表示 - WordPress
  29. Top List of the Best and Must Use WordPress Plugins | Tips and Tricks
  30. Fixing Syntax Highlighter Plus Problem On Some Theme
  31. Накладываем логотип на изображение посредством HTML/CSS | ex.periment.com
  32. Displaying Shortcodes within Posts | Double Black Design
  33. SyntaxHighlighter Plus « わに小屋
  34. New Version of SyntaxHighlighter Plus Released! | Beyond Coding
  35. A quick mention for useful tools | ukstokes.com
  36. Adding code into your WordPress posts - SyntaxHighlighter Plus - Seags
  37. format arduino sketches for blogs
  38. SyntaxHighlighter Plus v1.0b2 Released | Beyond Coding
  39. Merls Blog | Bestimmte Zeilen in Excel aus Txt einlesen und zählen
  40. List of the Best and Must Use WordPress Plugins :WordPressStudios.tk
  41. The Hyphen, Hyphen, Double-Dash Dilemma | The InkWells
  42. toledo’s code blog » Blog Archive » Getting syntax highlighter to work on wordpress’s homepage (on some themes)
  43. YAIMO BLOG » WordPress プラグイン コードを貼りたい(1) WP-Syntax
  44. myBlog » Blog Archive » WP Plugin - SyntaxHighlighter Evolved
  45. SyntaxHighlighter Plus No Longer Being Maintained | Beyond Coding
  46. James’ Blog » Wordpress plugins I can’t live without
  47. » SyntaxHighlighterを導入しました document.this.co
  48. List of the Best and Must Use WordPress Plugins | Blogging Planet
  49. Überflüssige Plugins ausgemistet und bereit zur Wiederverwertung » Beitrag » Dackworld
  50. Release: [Wordpress Plugin] SyntaxHighlighter Plus | Beyond Coding
  51. Satake Studio Developer’s Blog » ソースコードのカラー表示
  52. WordPressプラグイン:ソースコードをハイライト表示する
  53. WordPress Tricks : Plugins that Must Use | Tricks Window
  54. ওয়ার্ডপ্রেস এর প্রয়োজনীয় কিছু প্লাগইন ডাউনলোড করুন! প্লাগিন্স এর বিশাল পোস্ট!!! « টিপসঃ সিস্টেম
  55. Very Useful wordpress plugins | Wordpress New Tricks For Begginers
  56. WP Plugin – SyntaxHighlighter Evolved | 亞特蘭提斯
  57. List of the Best and Must Use WordPress Plugins | Free Styles Center
  58. Some Very Useful Plugins For Your Wordpress Site | Google Fizz
  59. Best Wordpress Plugins | computersoftinfo.com
  60. List of the Best and Must Use WordPress Plugins | Wbcom Designs | WordPress, WPMU, Buddypress & WP Performance Optimization Expert - Programmer / Developer
  61. List of the Best and Must Use WordPress Plugins | Wbcom Designs INC
  62. 2012 List of the Best WordPress Plugins - Technology News - Technology Blog - Tech Africa
  63. Plugins Are Tools To Extend The Functionality Of The WordPress - JaneMartin.us
  64. hybrid them
  65. The Top WordPress Plugins
  66. List of the Best and Must Use WordPress Plugins | Mrsatishgupta
  67. List of the Best and Must Use WordPress Plugins « prakashmca007
  68. ওয়ার্ডপ্রেস এর প্রয়োজনীয় কিছু প্লাগইন ডাউনলোড করুন! প্লাগিন্স এর বিশাল পোস্ট!!!
  69. Daftar Plugins Terbaik Yang Harus Di Gunakan | Nandy Wijaya™
  70. List of Best and Usefull Wordpress Plugins For Your Website | YouthYantra.com
  71. Best and Must Use WordPress Plugins - Welcome Back
  72. Lista cu Cele mai Bune si Necesare Plugin-uri pentru WordPress
  73. List of the Best and Must Use WordPress Plugins | Market Soft
  74. Must use Plugins for Wordpress | Web Design Depot
  75. Important Wordpress plugins that you must have | Construct Internet
  76. Best and Must Use Plugins
  77. Best and Must Use WordPress Plugins
  78. Free Essential WordPress Plugins You Should Use | CodeSplash
  79. List of the Best and Must Use WordPress Plugins | Online Tutorial Group
  80. Daftar Plugin Terbaik Wordpress | Belajar WordPress
  81. Must use wordpress plugins | zerobulletin
  82. Top Wordpress Plugins of 2013 | Wordpress Website Tricks

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>