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

Content added Content deleted
(→‎About bugs in GeSHi: Going to use GeSHi svn HEAD.)
Line 261: Line 261:


: I've just found that the "fail" on unsupported languages indeed fails, i.e. doesn't work correctly. See e.g. [[http://www.rosettacode.org/wiki/Apply_a_callback_to_an_Array#E]]. Looking at the generated HTML, you obviously inserted <code> tags instead of <pre> tags. --[[User:Ce|Ce]] 16:57, 30 January 2009 (UTC)
: I've just found that the "fail" on unsupported languages indeed fails, i.e. doesn't work correctly. See e.g. [[http://www.rosettacode.org/wiki/Apply_a_callback_to_an_Array#E]]. Looking at the generated HTML, you obviously inserted <code> tags instead of <pre> tags. --[[User:Ce|Ce]] 16:57, 30 January 2009 (UTC)

===Inconsistent content model===
There's a problem with this fallback: if the language is recognized, then the content is treated literally (except for </lang>, of course), but if it is unrecognized, then it is treated as HTML. The following two examples are of <lang foo>abc <fnord> def</lang> and <lang c>abc <fnord> def</lang>:
<lang foo>abc <fnord> def</lang>
<lang c>abc <fnord> def</lang>
This difference means that code examples containing &lt; or &amp; will stop displaying correctly if the specified language becomes supported.
I would prefer that everything be treated as HTML (as &lt;pre>, indenting, and the current unsupported-language behavior do) so that it's possible to insert markup in examples (e.g. hyperlinks in comments), </lang> is not a magic string impossible to include, and for consistency with most of the rest of HTML.
On the other hand, treating the content literally does have the advantage of making it easier to paste in examples containing &lt;s.
--[[User:Kevin Reid|Kevin Reid]] 00:36, 9 February 2009 (UTC)


== Code tag special behaviour ==
== Code tag special behaviour ==