XHTML compliance

1 view
Skip to first unread message

Ernest

unread,
Jul 31, 2007, 2:29:12 AM7/31/07
to syntaxhighlighter
Hello,

I've been using server side syntax highlighter solutions and wanted a
js one. I discovered this amazing piece of software and I think it is
great!

Sorry if this is alredy discussed...

IMHO, the lack of xhtml support (<pre> doesn't have an attribute
'name' in XHTML, so it is not valid) is a great disadvantage as it is
necessary for the project to succeed.

I think it would be better to look for code inside code tags
(<pre><code> var a; </code></pre>) rather than simple pre tags for the
sake of semantics, or giving the user the option to look for code
within any element, searching by class name (e.g. <div class="code
php">$foo='bar';</div>).

Changes in the code would be minimal. It took me 5 minutes to get the
uncompressed js file changed so that it works like this:


window.onload = function(){
dp.SyntaxHighlighter.ClipboardSwf = '/swf/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
/* 'code' being the class of the <code> elements I want to
highlight */
};

In the xhtml, the code element has 2 classes, the first indicates that
the element must be highlighted, and the second indicates the
language.

<pre>
<code class="code js">

var foo = function(){ return 'bas'; };

</code>
</pre>


By the way, it would be cool to automatically include the language
files as needed instead of including them manually.

Congratulations again for the great job.

Best Regards,

Ernest

Reply all
Reply to author
Forward
0 new messages