XHTML compliance

7 views
Skip to first unread message

mhavila

unread,
Oct 21, 2007, 1:08:56 PM10/21/07
to syntaxhighlighter
I've just start using SyntaxHighlighter and loved it! Thanks for the
great work.

The only issue is it not being XHTML compliant, since NAME is not a
valid attribute in PRE as of XHTML 1.0.
Use the CODE tag, or use "code" as an additional class attribute
value, would suffice to identify the code blocks to be formatted, in a
valid HTML and XHTML strict syntax.

This topic was already covered by Ernest in the following post, and I
endorse his words entirely:
http://groups.google.com/group/syntaxhighlighter/browse_thread/thread/e6dac1c90d8faaa1/

Best Regards,
Marcio
Brazil

ke...@centropy.com

unread,
Nov 29, 2007, 9:20:42 PM11/29/07
to syntaxhighlighter

On Oct 21, 9:08 am, mhavila <mhav...@gmail.com> wrote:
> The only issue is it not being XHTML compliant, since NAME is not a
> valid attribute in PRE as of XHTML 1.0.

I noticed this problem today and fixed it for myself. Hopefully it
works for others and maybe it can be included in the dist.

http://kev.in/2007/11/29/using-dpsyntaxhighlighter-with-valid-xhtml/

$ diff shCore.js.orig shCore.js
618c618
< if(tags[i].getAttribute('name') == name)
---
> if(tags[i].getAttribute('name') == name || tags[i].className.indexOf(name)==0)
627a628
> FindTagsByName(elements, name, 'code');
657a659
> options = options.replace(new RegExp("^"+name+"\\s"), ''); // Turn 'dp-hilite ruby:option1:option2' into 'ruby:option1:option2'


~Kevin

WishMaster

unread,
Dec 29, 2007, 8:04:43 PM12/29/07
to syntaxhighlighter
If you use <textarea> instead of <pre>, name can be used without
making the (X)HTML invalid.
Reply all
Reply to author
Forward
0 new messages