Topic: Basic syntax colouring with line numbers
Firstly, i realise there are a bunch of syntax colouring mods out there, but I like to make my own mods instead, i like to know exactly how things work and its good practice. You can see a demo, along with the instructions here: http://www.syi.cc/viewtopic.php?pid=521483#p521483
I am not properly releasing this mod yet, as it has afew things in it I would like to get sorted first.
- Escape characters are not handled properly within strings, for example in line 20 in the first code tag.
This of course should be continuously coloured, as the whole thing is ment to be a string.
- If the line is too long, it pushes onto the next line, eg.
$text .= '</p><div class="codebox"><div class="incqbox"><h4>'.$lang_common['Code'].':</h4><div>'."\n".parse_code($inside[$i])."\n".'</div></div></div><p>';
- Keywords are highlighted even if part of a word. Eg:
I assume in regex there must be an easy enough way to specify it must not be surounded by alphanumeric chars? Ill look into it later on, as I said, my regex isn't top.
- I would like to have the current line being hovered over highlighted. This is simple enough for FF, as you can use li:hover in css. However in IE :hover is only defined for a tags, with a href property. Is there some way around this?
Really I am posting this, hoping for some help fixing these problems, to be fair I haven't actually tackled either properly yet, but my regex knowledge isn't amazing (for the first one is there some way to say the ending tag must not be followed by a \?).
Any input is appreciated.