Search

bbPress Showcase » bbpress bbPress Chat

Syntax highlighter plugin?

RSS

Tags:


  1. Vadi
    User has not uploaded an avatar

    junior member
    Joined: Sep '08
    Posts: 5

    offline

    Anyone know of a source code highlighter plugin? Only found one on bbpress and that one fails to activate.

    A port of either the wp plugin that uses geshi ( http://wordpress.org/extend/plugins/wp-syntax/ ) or one that uses google's highlighting ( http://wordpress.org/extend/plugins/google-syntax-highlighter/ ) would do...

    Posted 2 months ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 330

    offline

    Porting WordPress plugins to bbPress is fairly easy.
    If it's meant to modify text, you just have to change the filter to "post_text".

    I'll take a quick look at those.

    Posted 2 months ago #
  3. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 330

    offline

    In WP-Syntax, just change the part at the end:

    // Add styling
    add_action('wp_head', 'wp_syntax_head');
    
    // We want to run before other filters; hence, a priority of 0 was chosen.
    // The lower the number, the higher the priority.  10 is the default and
    // several formatting filters run at or around 6.
    add_filter('the_content', 'wp_syntax_before_filter', 0);
    add_filter('the_excerpt', 'wp_syntax_before_filter', 0);
    add_filter('comment_text', 'wp_syntax_before_filter', 0);
    
    // We want to run after other filters; hence, a priority of 99.
    add_filter('the_content', 'wp_syntax_after_filter', 99);
    add_filter('the_excerpt', 'wp_syntax_after_filter', 99);
    add_filter('comment_text', 'wp_syntax_after_filter', 99);

    to:

    // Add styling
    add_action('bb_head', 'wp_syntax_head');
    
    // We want to run before other filters; hence, a priority of 0 was chosen.
    // The lower the number, the higher the priority.  10 is the default and
    // several formatting filters run at or around 6.
    add_filter('post_text', 'wp_syntax_before_filter', 0);
    
    // We want to run after other filters; hence, a priority of 99.
    add_filter('post_text', 'wp_syntax_after_filter', 99);

    And it should work in bbPress.
    The google syntax highlighter code seems huge with too many externals so I don't recommend it. Even Geshi is nearly 200k of PHP code which is insane but still faster than Google's javascript.

    I won't be running it here until I find a lighter solution.

    Posted 2 months ago #
  4. Vadi
    User has not uploaded an avatar

    junior member
    Joined: Sep '08
    Posts: 5

    offline

    I think it's that big because of the many different languages it supports. I'll try and give this a try though, thank you.

    Posted 2 months ago #

RSS feed for this topic

Post a reply to “Syntax highlighter plugin?”

You must log in to post.

keep _ck_ coding >> donate $1 <<     Theme Switcher:
7 users online from  US in the past 30 minutes. 5 bots 2 guests
359 views today 2798 yesterday 3411 ever. Most at once 19 today 24 yesterday 19 ever. Visited today: _ck_
724 posts in 106 topics over 19 months by 146 of 676 members. Latest: nicoosuna, Wish, insightdesigns