• Since I deactivated the visual editor, I have no longer problems to display some spcl characters like ampersand and brackets.

    Unfortunately my highlighted code (always) is indented by 8. I changed the TAB-WIDTH the geshi.php and also the language files (in my case c.php) to lower values, but my tab indenation nevertheless remains the same (8 spaces).

    What am I missing? Can anyone point me into the right direction?

    Thx.

Viewing 2 replies - 1 through 2 (of 2 total)
  • gringo, By default, Geshi wraps code blocks in pre tags (header_type = GESHI_HEADER_PRE). In this mode, tabs are not substituted for spaces, so the browser is displaying the tab directly and the width is browser dependent.

    Personally, I avoid tabs like the plague in my source code, but if you’re not like me, you can try setting the header type to GESHI_HEADER_DIV. For example:

      $geshi->set_header_type(GESHI_HEADER_DIV);
      $geshi->set_tab_width(2);
    

    Note, this will probably require that you modify your CSS styling afterwards.

    To make this change without modifying the wp-syntax source directly, you can add your own custom plugin that contains code like this:

    <?php
      add_action('wp_syntax_init_geshi', 'geshi_change_tabs');
    
      function geshi_change_tabs(&$geshi)
      {
        $geshi->set_header_type(GESHI_HEADER_DIV);
        $geshi->set_tab_width(2);
      }
    ?>
    
    Thread Starter gringo

    (@gringo)

    dear rmm5t, your help is very much appreciated.

    Since I’m too much of a bimbo with word press and its plugins I didn’t manage to add my own plugin. But, as I can avoid tabs from the begining (as you mentioned) by converting them into spaces I no longer have this problem. My Textpad editor allows me to do so very nicely).

    However, I still want to figure out what you actually meant with GESHI_HEADER_DIV and how to implemnt my own plugins….can’t be that hard, right?!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displayed TAB-WIDTH remains “8”,’ is closed to new replies.