Skip to content

Setting the Tab Width

Andreas Gohr edited this page Mar 13, 2017 · 1 revision

If you’re using the <pre> header, tabs are handled automatically by your browser, and in general you can count on good results. However, if you’re using the <div> header, you may want to specify a tab width explicitly.

Note that tabs created in this fashion won’t be like normal tabs - there won’t be “tab-stops” as such, instead tabs will be replaced with the specified number of spaces - just like most editors do.

To change the tab width, you call the set_tab_width() method:

$geshi->set_tab_width($width);

Where $width is the width in spaces that you’d like tabs to be.