Wiki - syntax highlighting
Moderator: Forum Moderators
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Wiki - syntax highlighting
You can now apply syntax highlighting to code snippets on the wiki! This works for almost any language you can think of, including WML.
The syntax for this is:
Other likely values for lang='""
Other options that can be added to the opening tag:
The syntax for this is:
Code: Select all
<syntaxhighlight lang="wml">
[some_tag]
some_key=some_value
[/some_tag]
# etc etc
</syntaxhighlight>
- wfl - Formula language, for example for formula= in Standard Unit Filters.
- fai - Also formula language, but for AI (the only difference from wfl is that it highlights additional built-in functions)
- lua - Self-explanatory - doesn't highlight Wesnoth API functions though
- cpp - C++ code
Other options that can be added to the opening tag:
- line - Enable line numbering. This is a little buggy, though, as the line numbers are muddled up with the code.
- start="10" - Line numbering starts at the specified line (requires the above to be present too).
- highlight="1,2,5-9" - Highlight some lines to draw attention to them.
- inline - Use this to include a small snippet of code in the middle of running text.
Re: Wiki - syntax highlighting
How about WML syntax highlighting for code in the forums?
Wesnoth Bestiary ( PREVIEW IT HERE )
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
Unit tree and stat browser
Canvas ( PREVIEW IT HERE )
Exp. map viewer
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Wiki - syntax highlighting
Shadowm (who's the one who set this up) said he wanted to upgrade the forum software before considering forum syntax highlighting. I'm also not sure if there's a Pygments-based syntax highlighting extension for phpBB — MediaWiki uses Pygments in its official syntax highlighting extension, and because of that, I chose it to write my WML syntax highlighter with.
So, basically... it's a thing that might happen, eventually, but there are things to be worked out first.
So, basically... it's a thing that might happen, eventually, but there are things to be worked out first.
Last edited by Celtic_Minstrel on March 18th, 2016, 5:01 am, edited 1 time in total.
Reason: Shadowm demanded name change
Reason: Shadowm demanded name change