Village Pump:Home/Syntax Highlighting ( archived 2009-06-18 ): Difference between revisions

Content added Content deleted
(→‎Whitespace: An obscure way to get "uncommented" Whitespace code)
Line 172: Line 172:
: (note that this probably isn't a valid whitespace program; I just randomly added spaces/tabs).
: (note that this probably isn't a valid whitespace program; I just randomly added spaces/tabs).
: However, last friday, whitespace got nicely colored (tabs were bright red and spaces bright blue, IIRC). Now it's just white. Looking at the generated HTML, it seems classes "re2" (space) and "re3" (tab) are responsible for whitespace hilighting. Setting the background property for them should re-enable whitespace highlighting. --[[User:Ce|Ce]] 11:57, 26 January 2009 (UTC)
: However, last friday, whitespace got nicely colored (tabs were bright red and spaces bright blue, IIRC). Now it's just white. Looking at the generated HTML, it seems classes "re2" (space) and "re3" (tab) are responsible for whitespace hilighting. Setting the background property for them should re-enable whitespace highlighting. --[[User:Ce|Ce]] 11:57, 26 January 2009 (UTC)
:: I've now found a trick to get Whitespace highlighting without any (visible) text around it: Use the Unicode character U+FEFF (ZERO WIDTH NO-BREAK SPACE) to mark the start/end of the code:
<code whitespace>


</code>
:: Note that U+FEFF renders as absolutely nothing, and is not whitespace as defined by Whitespace (although it ''is'' whitespace according to Unicode), and therefore should be ignored as "comment" by whitespace interpreters (I didn't test that, though). It apparently also isn't considered whitespace by the start/end line removing code, therefore it's not removed. --[[User:Ce|Ce]] 15:22, 26 January 2009 (UTC)