Adding IDs to Each Line - GeSHi/geshi-1.0 GitHub Wiki
Perhaps you’re a javascript junkie? GeSHi provides a way to give each line an ID so you can access that line with javascript, or perhaps just by plain CSS (though if you want to access lines by CSS you should use the method in the previous section). To enable IDs you call the enable_ids()
method:
$geshi->enable_ids($flag);
Where $flag
is true
or not present to enable IDs, and false
to disable them again if you need.
The ID generated is in the form {overall-css-id}-{line-number}
. So for example, if you set the overall CSS id to be “mycode”, then the IDs for each line would by “mycode-1”, “mycode-2” etc. If there is no CSS ID set, then one is made up in the form geshi-[4 random characters]
, but this is not so useful for if you want to do javascript manipulation.