Page MenuHomePhabricator

Source code highlighting
Closed, ResolvedPublic

Description

Author: wikibugs

Description:
I suggest a feature to highlight sorce code or other things, depending on the
given definitions.

Example for a possible tag: <highlight C> </highlight>

I thought, the syntax could be defined in Specialpages like Special:Highlight:C

Example Definition for C highlighting:

basecolors: black on white
string between "/*" and "*/" : green italic override include_delimiter
string between "//" and "\n" : #00AA00 override include_delimiter
string between "\"" and "\"" : #777777 override
keywords{ #include #define #ifndef } red
keywords{ void int long short char float double } blue bold

alternative for keywords:
keywords( blue bold )
{
"return"
"static"
"const"
}

"override" is ment to prevent application of other rules on this string.
maybe it should better be named "final" and only prevent the following rules,
not all.
"include_delimiter" means that the delimiters are formatted, too.
alternative: include_delimiter(1,2) meaning the first and second delimiter are
included.

im not sure if this rules are enough for several language, but here is an idea
for a html-tag with or without parameters:

string between "<" and ">" : blue bold include_delimiter
substring between " " and ">" black narrow

(but i am not sure if this is a good solution...)


Version: unspecified
Severity: enhancement
Platform: PC

Details

Reference
bz807

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:03 PM
bzimport set Reference to bz807.
bzimport added a subscriber: Unknown Object (MLST).

A GeSHi-based syntax highlight extension for MediaWiki 1.5 is
available in our extensions module in CVS.

http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/Highlight/SyntaxHighlight.php?view=markup