Dec 29 2008

WP-SynHighlight

FractalizeR @ 1:13 pm

What is it?

WP-SynHighlight is a WordPress plugin that allows easy syntax highlighting of source code you post in your blog. It works much like any other BBCode tag. It highlights everything you put between codesyntax BB code tags

You can download plugin and read a comprehensive description of all additional features provided by it  at it’s official page at Plugins @ WordPress.org page. Below you will find a set of examples for various programming languages:

Java language example:

import java.util.*;
public class Sample {
    public static void main(String[] args) {
        // Создание объекта по шаблону.
        List<String> strings = new LinkedList<String>();
        strings.add("Hello");
        strings.add("world");
        strings.add("!");
        for (String s : strings) {
            System.out.print(s);
            System.out.print(" ");
        }
    }
}

PHP language example:

<?php
    function parse_code () {
        // Start the timer
        $start_time = microtime();
        // Firstly, if there is an error, we won't highlight
        if ($this->error) {
            //Escape the source for output
            $result = $this->hsc($this->source);
            //This fix is related to SF#1923020, but has to be applied regardless of
            //actually highlighting symbols.
            $result = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $result);
            // Timing is irrelevant
            $this->set_time($start_time, $start_time);
            $this->finalise($result);
            return $result;
        }

C++ Language example:

#include <iostream>   // для использования std::cout
#include <vector>     // для std::vector<>
#include <map>        // для std::map<> и std::pair<>
#include <algorithm>  // для std::for_each()
#include <string>     // для std::string
 
using namespace std;  // используем пространство имён "std"
 
void display_item_count(pair< string const, vector<string> > const& person) {
   // person - это пара двух объектов: person.first - это его имя,
   // person.second - это список его предметов (вектор строк)
   cout << person.first << " is carrying " << person.second.size() << " items" << endl;
}
 
int main()
{
   // объявляем карту со строковыми ключами и данными в виде векторов строк
   map< string, vector<string> > items;
 
   // Добавим в эту карту пару человек и дадим им несколько предметов
   items["Anya"].push_back("scarf");
   items["Dimitri"].push_back("tickets");
   items["Anya"].push_back("puppy");
 
   // Переберём все объекты в контейнере
   for_each(items.begin(), items.end(), display_item_count);

Some screenshots:

100 Responses to “WP-SynHighlight”

  1. Sonar says:

    Отличнейший плагин. С виду простой, а результат поражает. Еще бы прикрутить подсветку кода в комментариях.
    мой небольшой обзор http://dobrih.net/2009/01/podsvetka-programmnogo-koda-v-wordpress/

  2. Kevin Blake's Blog - Even the wrong words seem to rhyme » Blog Archive » Code Highlighting, and the magic of LINQ says:

    […] I picked up the WP-SynHighlight extension for WordPress.  Which gives some rather cool code-highlighting through […]

  3. Wordpress плагины, лучшие вордпресс плагины. Wordpress обратная связь, подсветка кода wordpress. says:

    […] WP-SynHighlight – при частой работе с редактором тем, необходимо установить подсветку кода wordpress редактора, так как удобнее ориентироваться в коде. Подсветка кода wordpress в данном плагине реализована просто и хорошо смотриться, поэтому рекомендую. […]

  4. FractalizeR’s WebSite » [JavaScript] PHP PCRE_DOT_ALL option emulation in JavaScript says:

    […] my WP-SynHighlight WordPress plugin, I came to a need of parsing multilined shortcode like this: Code block   <many […]

  5. FractalizeR’s WebSite » [JavaScript] EditArea: Realtime Syntax Highlighting JavaScript Library says:

    […] improving my WordPress plugin WP-SynHighlight, I chose EditArea as a source code editor with realtime syntax highlighting. The syntax of language […]

  6. WP-SynHighlight f?r WordPress says:

    […] für WordPress 6. Januar 2010 | Autor: KHK Das Plugin WP-SynHighlight für WordPress von Vladislav Rastrusny realisiert Syntax Highlighting in Postings und […]

  7. WP-SynHighlight erm?glicht Syntax Highlighting says:

    […] unseren RSS Feed abonnieren.Powered by WP Greet Box WordPress Plugin Das WordPress Plugin WP-SynHighlight ermöglicht Syntax Highlighting in Postings und Kommentaren. Das Plugin verfügt über […]

  8. Plugins fuer Syntax-Highlighting | Internet und Webpromotion says:

    […] Fractalizer.ru mit WP-SynHighlighting, leider englischsprachig […]

  9. WordPress????-1?19? - WordPress ?????? says:

    […] WP-SynHighlight ??????WP-SynHighhlight???? […]

  10. PHP Code mit dem Plugin WP-SynHighlight anzeigen says:

    […] gut, wenn man für die Päsentation ein Tool zur Verfügung hat. Das WordPress Plugin WP-SynHighlight von Vladislav Rastrusny realisiert Syntax Highlighting in Postings und Kommentaren des Blogs. Das […]

  11. NsYta says:

    If I don’t want to display the code-block,,,What can I do. ???
    Because When the code has only one line…it display the code-block looks too heavery

  12. WordPress????-1?19? | Kum??? says:

    […] WP-SynHighlight ??????WP-SynHighhlight???? […]

  13. The pain of posting code into wordpress | Some More Bytes says:

    […] after reading a ton of documentation, and trying to find the proper way to do it I found this great plugin. WP-Synhighlight It is Geshi based, and it has a code editor included which will respect all the […]

  14. ???? 10 ?????? ?????? ????? ???? ?????? says:

    […] ????? ??? ??????? ?? ????? ????? ???? ?????? ?????? ????? ??? ???? ??? ??????? ?? ????? ??? ??????? ??? ?????? ??????? ????? HTML  ??? ????? ??????  ????? ??? ?????? ?? ???????? ??????? ??? ????? ?? ???????? ???? ??? ???? ??????? WP-SynHighlight. […]

  15. wp-popular.com » Blog Archive » FractalizeR’s WebSite » WP-SynHighlight says:

    […] the original post: FractalizeR’s WebSite » WP-SynHighlight Tags: […]

  16. ?????? » Blog Archive » WordPress????-1?19? says:

    […] WP-SynHighlight ??????WP-SynHighhlight???? […]

  17. ?????? » Blog Archive » WordPress????-1?19? says:

    […] WP-SynHighlight ??????WP-SynHighhlight???? […]

  18. 9. SyntaxHighlighter Plus | MR G5 says:

    […] ????? ??? ??????? ?? ????? ????? ???? ?????? ?????? ????? ??? ???? ??? ??????? ?? ????? ??? ??????? ??? ?????? ??????? ????? HTML  ??? ????? ??????  ????? ??? ?????? ?? ???????? ??????? ??? ????? ?? ???????? ???? ??? ???? ??????? WP-SynHighlight. […]

  19. FractalizeR says:
    Code block    
    <?php
    echo("Testing testing");
  20. jblock says:

    Thank you for your fix. I look forward to using your excellent plugin again.

  21. FractalizeR says:

    I hope I didn’t introduce any new bugs with this fix 😉
    If so, you are more than welcome to kick me to fix them 😉

  22. Zv?raz?ov?n? syntaxe pro Wordpress says:

    […] syntaxe, proto?e u? m? nebav? d?lat tohle v ?l?nc?ch ru?n?. Celkem mi vyhovuje WP-SynHighlighter. Sice neum? takzvan? ‘multihighlighter’ jako t?eba PSPad (nebo j? jsem aspo? […]

  23. 10 ?????? ?????? ??? ?????? ????? ?? ?????? « ?????.?? | ???? ???? ????? says:

    […] ????? ??? ??????? ?? ????? ????? ???? ?????? ?????? ????? ??? ???? ??? ??????? ?? ????? ??? ??????? ??? ?????? ??????? ????? HTML  ??? ????? ??????  ????? ??? ?????? ?? ???????? ??????? ??? ????? ?? ???????? ???? ??? ???? ??????? WP-SynHighlight. […]

  24. WordPress Themehacks » Syntax Highlighting Plugins f?r WordPress says:

    […] Plugins für WordPress Geschrieben am 10. Januar 2011 by KHK Das WordPress Plugin WP-SynHighlight von FractalizeR ermöglicht Syntax Highlighting in Postings und Kommentaren. Das Plugin […]

  25. Самые популярные русские плагины WordPress | RUDEBOX says:

    […] WP-SynHighlight – при частой работе с редактором тем, необходимо установить подсветку кода wordpress редактора, так как удобнее ориентироваться в коде. Подсветка кода wordpress в данном плагине реализована просто и хорошо смотриться, поэтому рекомендую. […]

  26. baychaser1 says:

    My theme doesnt like it for some reason is there something that I can change or add to fix it.
    This is how it looks like in my test post.
    Here is the direct link to my screen shoot.

    http://img525.imageshack.us/img525/6681/screenshot1tr.jpg

    Uploaded with ImageShack.us

  27. Kaluriel says:

    The GUI is broken with the latest wordpress update 🙁

  28. FractalizeR says:

    I’ll have a look, thanks.

  29. FractalizeR says:

    @Kaluriel – it works for me. Aren’t you using SSL to access your blog’s admin panel?

  30. Kaluriel says:

    My apologies, it wasn’t the new WordPress, I had updated some new plugins at the same time I had upgraded my WordPress, one of them broke it.
    Thanks for the help. 🙂

Leave a Reply

You must be logged in to post a comment. Login now.