-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers that are all numbers do not create ID attribute #29
Comments
Since XHTML does not permit IDs which are wholly numeric, I don't think the behaviour you suggest will help you in the end. You might need some other workaround. |
That makes sense. I do have a workaround for this case. But the programmers could prefix or suffix the ID with a letter to make it compatible with XHML, or have an option to do this. As it stands right now, Text::MultiMarkdown is not totally compatible with XHTML. |
It is compatible with XHTML, at least in this respect. The Text::Multimarkdown module simply recognises that trying to consistently implement the heading IDs feature of MMD would create invalid HTML under certain conditions, and chooses standards compliance over strict consistency, which I think is a reasonable decision given that markdowns are for writing HTML documents. I don't think there's an obviously better solution here - whatever arbitrary prefix you choose (and it needs to be a prefix, as the restriction is that the ID must begin with a letter) could cause conflicting ids anyway. The MMD test suite doesn't indicate either way what the expected behaviour is. There is an option |
What I meant was, this is not totally compatible with XHTML for EPUB books. In EPUB, every link destination from the table of contents, like headers, must have a unique ID. (I convert all headers in my MMD to be entries in the EPUB TOC.) To make sure of uniqueness in a whole EPUB book, I append a serial number to each header. So, I do have to do some processing of these all numeric headers after it's converted from MMD to XHTML, and then to EPUB. It's not a big deal, I fixed it on my own. Thanks for the info. |
When converting Markdown to XHTML, this Markdown header:
# 2012
Converts to this:
<h1>2012</h1>
when it should convert to:
<h1 id="2012">2012</h1>
Any other header that contains at least one letter work properly. I started using 4 digit years for some of my book headers and this bug popped up.
This MD header:
# This is a header
Converts properly to:
<h1 id="Thisisaheader">This is a header</h1>
The proper (and unique) IDs are required for XHTML when making EPUB books. I take care of the uniqueness.
The text was updated successfully, but these errors were encountered: