Le 2007-06-21 à 12:35, Phil Mocek a écrit :

Can anyone confirm that having the HTML fragment identifier
formatted as Thomas proposes is valid?  Both this [W3C design
issue paper][1] and [Wikipedia article][2] suggest otherwise, but
I'm not sufficiently familiar with this to say for certain.

[1]: <http://www.w3.org/DesignIssues/Fragment.html>
[2]: <http://en.wikipedia.org/wiki/Fragment_identifier>

The content for the id attribute for HTML 4 must obey [this rule][3]:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

[3]: http://www.w3.org/TR/html401/types.html#type-name


For XML, and by extension XHTML, it must obey the Name construct, which is defined as such [in the spec][4]:

NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
    Name ::= (Letter | '_' | ':') (NameChar)*

[4]: http://www.w3.org/TR/REC-xml/#NT-Name


Basically, HTML and XML both disallow digits as the first character of the id attribute. That's why the version number is preceded with a "v" in my profile page.

While invalid as an XML or HTML id value, a fragment identifier starting with a digit is still perfectly correct in a URL. Here's the definition of URL fragment according to [RFC 3986][5]:

    fragment    = *( pchar / "/" / "?" )
    pchar       = unreserved / pct-encoded / sub-delims / ":" / "@"
    unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
    pct-encoded = "%" HEXDIG HEXDIG
    sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                / "*" / "+" / "," / ";" / "="

[5]: http://tools.ietf.org/html/rfc3986


Michel Fortin
[EMAIL PROTECTED]
http://www.michelf.com/


_______________________________________________
Markdown-Discuss mailing list
[email protected]
http://six.pairlist.net/mailman/listinfo/markdown-discuss

Reply via email to