WordPress.org

Forums

add a hook to wp-syntax to enable changing syntax colors (3 posts)

  1. reedom
    Member
    Posted 8 years ago #

    To give a chance to blog owners to change Geshi's coloring or other behavior, how about add a hook like:

    *** /home/trac/www/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php~        Tue May 29 06:45:16 2007
    --- /home/trac/www/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php Fri Jul  6 17:52:13 2007
    ***************
    *** 73,78 ****
    --- 73,79 ----
    
          $geshi = new GeSHi($code, $language);
          $geshi->enable_keyword_links(false);
    +     do_action_ref_array('wp-syntax-init-geshi', array(&$geshi));
    
          $output = "\n<div class=\"wp_syntax\">";

    So blog owners can handle the hook in a hand-made plugin or somewhere else like this:

    add_action('wp-syntax-init-geshi', 'wpsc_change_styles');
    
    function wpsc_change_styles(&$geshi)
    {
        $geshi->set_brackets_style('color: #000;');
        $geshi->set_keyword_group_style(1, 'color: #22f;');
    }
  2. rmm5t
    Member
    Posted 8 years ago #

    @reedom, Excellent idea. This will go in the next release. Ticket 667

  3. rmm5t
    Member
    Posted 7 years ago #

    @reedom, I thought you'd be interested to know that your patch is now incorporated into the latest version of WP-Syntax (v0.6). Thanks again for the great idea.

    One thing to note. I chose to use an action name of "wp_syntax_init_geshi" instead of "wp-syntax-init-geshi" (underscores instead of dashes).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags