Help:Syntax Highlighting: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (Geishi no longer supported) |
Thundergnat (talk | contribs) m (missed some) |
||
Line 2: | Line 2: | ||
== How to highlight == |
== How to highlight == |
||
Prefix your code with <code><lang |
Prefix your code with <code><syntaxhighlight lang="foo"></code> (where ''foo'' is the language to use for highlighting) and suffix it with <code></syntaxhighlight></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> |
<pre> |
||
Line 23: | Line 23: | ||
Also, if it hasn't been done yet, add the identifier to your language's category page. Use the "tags" parameter in the [[Template:Language|language template]] to specify it (e.g. "tags=foo" for the example above). If you find that your language already has a tag listed there that isn't in the Village Pump post, add it to the post as well. |
Also, if it hasn't been done yet, add the identifier to your language's category page. Use the "tags" parameter in the [[Template:Language|language template]] to specify it (e.g. "tags=foo" for the example above). If you find that your language already has a tag listed there that isn't in the Village Pump post, add it to the post as well. |
||
If you'd like to, it's |
If you'd like to, it's not difficult to write a new language definition for Pygments. See [https://pygments.org/docs/lexerdevelopment/ Write your own lexer] for more on adding support for a new language. |
||
===Recommended language tag usage=== |
===Recommended language tag usage=== |