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.

[php htmlscript=”true” highlight=”12″]<!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>[/php]

If you prefer, you can hide the line numbering and other UI stuff with the “light” mode, for example:

[code light=”1″][[php light="true"]your code here[/php]][/code]

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. Pingback: Wordpress Syntax Highlighting « « babblative.com babblative.com

  2. Hello,
    When I show single.php pages the code is´n formatted, , but index.php.
    just for discard I’ve copied all the index.php code in single.php…

    surprise!

    same php code has Highlight effect when render using index.php but single.php.

    Why this is happen?

    What can I do?

  3. Debugging, I get this when same code run on single.php

    “SCRIPT5022: DOM Exception: NOT_FOUND_ERR (8) ”
    [code]
    document.getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("syntaxhighlighteranchor") )
    [/code]

  4. Resolved!
    for some reasons my theme had in the header something like
    [code] <?php if ( is_single() ) { ?> plain text <?php } ?> [/code]

  5. Pingback: WordPress3.1??????????????plugin×17 | b-log

  6. Pingback: My Favourite Wordpress Plugins - babblative.com ›

  7. Pingback: WordPress | ingegno.it

  8. Pingback: ?????? syntaxhighlighter ?????????? | ????????

  9. Pingback: Last Ray of Hope » Syntax Highlighting

  10. Pingback: wordpress???? | ????

  11. Is there a maximum vertical size variable somewhere to be set? I would like to put a 400-line code block on my blog without literally taking up 400 lines.

    Also, I note that all code-blocks have vertical scroll bars in Chrome… looks like something is rendering 1-pixel too tall.

    Finally, is there a command line CSS? Would require little if any color with grey text on a black-ish background? Would be helpful when showing command-line examples.

    Really have to say thanks though, as no matter what, this is definitely the best highlighter out there.

  12. Pingback: Tutorial: Adding XAML To A Wordpress Post

  13. Pingback: ????? ????????? ???????? ?? ???????? « Sauyd's Blog

  14. All,

    I’ve tried everything and can’t seem to get this plugin to work correctly or any syntax highlighter for that matter. I’ve tried disabling all other pluigns on my site and even tried variations of the short codes. Does anyone have any thoughts as to why this isn’t working properly? http://www.adamestrada.net/2009/06/13/georss-from-c/ that is a page that it fails on. Your insight in to this is greatly appreciated…

    Adam

  15. Pingback: Der Fahrplan | HTML5-Blog

  16. Pingback: Wordpress + source code + LaTeX |

  17. Pingback: 21 Awesome Wordpress Plugins :Raised By Turtles

  18. Pingback: WordPress???????????????? ?SyntaxHighlighter Evolved? ??? « DTP??????WEB????????????? ???????????

  19. I’m getting vertical scroll bars in all of my code blocks since the last version. The problem doesn’t seem to affect IE or firefox, but it does seem to occur in Opera and Chrome.

    • I too am seeing vertical scrollbars on all blocks in Chrome, both on my own site and even on this site! Alex – do you have an update on a fix for this please?

  20. Pingback: Plugin collection « nealfive.de

  21. Pingback: SyntaxHighlighter Evolved Review – Best Wordpress Plugins

  22. Pingback: END[SEVEN] Web Development » Guess what? I updated my blog!

  23. I’m trying to add this on to my blog, and have attempted with the default theme and only this plugin running. It generally works well, but I’ve found that I can’t have a php include in the code. If I do so, even if it is not referencing a file, it will not save the post, but instead take me to a 404 page. For the moment I am misspelling the word include, and it is displaying with the misspelling. I haven’t seen anyone post about this yet, and was curious if there was a fix for it.

    Thanks!

      • I’m not really sure how I’d go about testing it, though yes, I cannot show them within code tags in any way.

        • Your host is likely blocking the POST thinking it’s a hacking attempt.

          I think you need to find a better host if they won’t provide support for something that is clearly not a third party application issue.

      • By the way, if you happen to follow this kind of thing, this is what would constitute a regular response from my host:

        “There are no issues with the server settings and all the settings is related with that particular application/software. We cannot provide such support as it is a third party application.
        Please let us know if anything needs to be changed at the server end .”

  24. Pingback: Librisbloggen » Hur vi använder Wordpress

  25. Pingback: Google is translating my code! | Tinsology

  26. Pingback: » Source Code in Wordpress Linux Sagas

  27. Pingback: ?????? - WordPress?SyntaxHighlighter Evolved???????

  28. I always add this line

    ‘xaml’ => ‘xml’,

    You might ask why I didn’t just tag them with xml, well, I used a different syntax highligher for a while that had the xaml option, so I have to because I am a lot of posts already tagged as follows:

    [code][xaml]
    <Page>…
    [/xaml][/code]

    Smile,

    Jared

    • Rather than editing my plugin, add this to your own plugin or your theme’s functions.php file:

      [php]add_filter( ‘syntaxhighlighter_brushes’, ‘syntaxhighlighter_add_xaml_alias’ );

      function syntaxhighlighter_add_xaml_alias( $brushes ) {
      $brushes[‘xaml’] = ‘xml’;

      return $brushes;
      }[/php]

  29. Pingback: Webridge?WordPress???????? | WeBridge

  30. Pingback: ???????? 10-?? ???????? ??? Wordpress | ???? ?????????

  31. Pingback: Wordpress Plugins | webmanufaktur.org

  32. Pingback: ????????? ???? ??????????? SyntaxHighlighter Plus |

  33. Pingback: Anonymous

  34. a most curious occurence. try to display the following as php code using your plugin:
    [code]<?php do_shortcode(‘[gallery]‘); ?>[/code]
    it’s a do_shortcode instruction, wrapped in opening and closing php tags, to invoke a shortcode called gallery. the name of the shortcode (gallery) disappears!!!
    yet I have seen that instruction displayed properly on wprecipes.com!!!
    (This is happening with V3.1.1 in 2.x or 3.x mode, on WP 3.1.2 in Local as well as online)

  35. Great plug-in!

    Is there a way to set a fixed height and use vertical a vertical scrollbar? My code is quite big and I don’t feel like make it collapseable…

  36. Pingback: ??Syntax Highlighter?Haskell???? | ArieShout ???

  37. Pingback: Publicando código fonte com Wordpress | Rafael de Meira Teixeira

  38. Pingback: END[SEVEN] Web Development » How fast do your WordPress pages load?

  39. Hi alex, how can I styling this plugin using CSS, for example I want the post font-size 14px, but I want the code snippet still 12px, thanks

  40. Pingback: SyntaxHighlighter Evolved: Haskell Brush | Código Fantasma

  41. Pingback: Code markup plugin | Bitter Blog

  42. Pingback: ??Syntax Highlighter?Haskell???? | ArieShout ???

Comments are closed.