Syntax highlighting

For modern syntax highlighting, see Community Tech/Wikitext editor syntax highlighting.
See User:Coffman/Syntax Highlight and User:Coffman/Geshi Syntax Highlight extension

Syntax highlighting mark up for programs?Edit

I'm kinda newbie here. I'd thought that there will be some kind of mark up for syntax highlighting of programs like <program lang="PHP">..code here..</program> But, I couldn't find anything such. So, I have experimented few syntax highlighting with PHP's highlight_file() in few articles: en:PHP programming language#Code_Examples, en:Hello world program#Perl, and en:C programming language#Hello,_World!_in_C As Wiki is fast, I strongly believe this might be already discussed. Could someone please direct me to such thing? TIA. --Rrjanbiah 12:21, 3 May 2004 (UTC)Reply[reply]

I've always thought syntax highlighting ugly. Others though may have good reasons to do so, though. It does make the code snippets difficult to edit, though... Dysprosia 13:16, 3 May 2004 (UTC)Reply[reply]
Wiki's own syntax highlighter something like <program lang="PHP">..code here..</program> may be helpful incase someone feels it is hard to edit the code. Is there any such projects going in Wiki anyway? --Rrjanbiah 13:21, 3 May 2004 (UTC)Reply[reply]
An additional problem with manually colouring syntax, like you have, is that it won't take into account properties of skins, a user's preferences, possible future non-Web versions, etc, etc. Which brings me to suggest that somebody (you?) could write an extension, à la <math> et al to do exactly what you say. This could then include abilities to vary based on skin/preference/display modality (or whatever it's called) in the same way as the other extensions - there's probably a description of the new modular extension architecture somewhere on meta, or will be soon.
Now, having said all that, I'm not sure whether I think highlighted code is better or worse, for such short bursts as we're likely to have here. It would probably be useful on wikibooks: though, where there are likely to be whole program listings... - IMSoP 16:02, 3 May 2004 (UTC)Reply[reply]
Yes, thanks for your comments. I can contribute to that. My idea is something like <program lang="php" highlight="yes">..code..</program>. And also, skinning as in PHP's enhanced help manual (one with copy to clipboard JS stuffs, etc) But, I thought that similar discussions might have done in Wiki and that's why asked. And, I can't promise about my contribution at this moment as I'm busy now. --Rrjanbiah 10:35, 8 May 2004 (UTC)Reply[reply]
have a look at geshi at It takes only a few lines to implement as mediawiki-extension. to see geshi at work in mediawiki have a look at my site at 14:02, 7 Jan 2005 (UTC)
Please see en:Talk:Hello_world_program#Color-coding_of_hello_world_programs and allow people to discuss such drastic edits in the future by taking them up on the appropriate talk pages. --Ævar Arnfjörð Bjarmason 00:32, 2004 May 6 (UTC)
Yes, I do care about Wiki. As stated in my edit summary, I was experimenting that and was planned to revert after few days (after getting some feedbacks). But, never thought that you would revert it immediately. --Rrjanbiah 10:35, 8 May 2004 (UTC)Reply[reply]