Help:Syntax Highlighting: Difference between revisions
Largely rewrote. (I removed the <lang list> here to encourage users to check the hand-maintained list on the Village Pump.)
(Fix example instructions, I don't think we need the old style example anymore) |
Underscore (talk | contribs) (Largely rewrote. (I removed the <lang list> here to encourage users to check the hand-maintained list on the Village Pump.)) |
||
Line 1:
At the moment, the wiki is
==
Prefix your code with <code><lang ''foo''></code> (where ''foo'' is the language to use for highlighting) and suffix it with <code></lang></code>. Be sure not to insert extra space between the tags and your code. For example, here's how you'd highlight a C program:
<pre>
<lang c>int main (int argc, char* argv[])▼
<lang c>▼
▲int main (int argc, char* argv[])
{
return 0;
</lang>▼
</pre>
That markup would be rendered thus:
▲ int main (int argc, char* argv[])
▲ {
▲}</lang>
▲ return 0;
== Supported languages ==
See [[Rosetta Code:Village Pump/Syntax Highlighting#Language tags|this post on the Village Pump]] for a list of language names. Make sure to use the standard identifier for your language even if GeSHi doesn't know how to highlight it yet. If your language isn't in the list, make up an identifier (consisting entirely of lowercase alphanumeric ASCII characters; make it short yet unambiguous) and add it to the list. That way, if your language is supported in a future release of GeSHi, Rosetta Code can immediately benefit.
If you'd like to, it's surprisingly easy to write a new language definition for GeSHi. See [[Rosetta Code:Village Pump/Syntax Highlighting#Relationship Between Rosetta Code and GeSHi|this post]] for more on the relationship between GeSHi and Rosetta Code.
|