fletcher / MultiMarkdown-4

This project is now deprecated. Please use MultiMarkdown-6 instead!
https://github.com/fletcher/MultiMarkdown-5
Other
307 stars 59 forks source link

Problem with id generation #54

Closed NicHub closed 10 years ago

NicHub commented 10 years ago

ID’s are not generated the same way on OSX and Windows when using accented characters. For example

# Table des matières

will output on OSX

<h1 id="tabledesmatires">Table des matières</h1>

but will output on Windows

<h1 id="tabledesmatières">Table des matières</h1>

Both output are wrong. The Windows one is even invalid. What I expect is

<h1 id="tabledesmatieres">Table des matières</h1>

or better

<h1 id="table_des_matieres">Table des matières</h1>
fletcher commented 10 years ago

I'll have to look at this when I get a chance (a week or so). I suspect, though, that the OS X one will end up being correct, as it's not so easy to simply say "drop the accent" in C.

If this bothers you, you can always manually specify an ID.

NicHub commented 10 years ago

Thank you to consider this question.

I made some checks and I noticed that in fact accented characters are valid in id attributes (HTML 5, XHTML 1.0 and XHTML 1.1 doctypes). Javascript understands accented characters as well. It means that you can change the OS X version only so that :

# Table des matières

returns

<h1 id="tabledesmatières">Table des matières</h1>

As I said, I would really prefer that you replace spaces with underscores. You can also consider to keep uppercase and lowercase characters :

<h1 id="Table_des_matières">Table des matières</h1>
fletcher commented 10 years ago

The standard for this has always been lower case with no space. I don't intend to change that behavior.

I'll look at the accented characters and decide the best approach.

F

Sent from my iPhone

On Jan 31, 2014, at 10:35 PM, gitnico notifications@github.com wrote:

Thank you to consider this question.

I made some checks and I noticed that in fact accented characters are valid in id attributes (HTML 5, XHTML 1.0 and XHTML 1.1 doctypes). Javascript understands accented characters as well. It means that you can change the OS X version only so that :

Table des matières

returns

Table des matières

As I said, I would really prefer that you replace spaces with underscores. You can also consider to keep uppercase and lowercase characters :

Table des matières

— Reply to this email directly or view it on GitHub.

fletcher commented 10 years ago

When running on OS X, I get:

<h1 id="tabledesmatières">Table des matières</h1>

which is valid. I don't have a Windows machine with me right now, but you said this is what you get on Windows, which is also correct.

Can you verify the behavior you are getting to define what you believe the problem is?

Thanks!

NicHub commented 10 years ago

It seems that version 4.5 behaves the same on Windows and OS X and the result is correct :

<h1 id="tabledesmatières">Table des matières</h1>

I saw the problem on OS X in May 2013. It wasn’t a big problem as long as I worked on the Mac alone. But recently I needed to work on Windows. So the Windows machine uses v4.5 and the Mac used v4.3.1. Now I have upgraded the Mac to v4.5 and everything is OK. The only problem is that I have to upgrade my CSS too. But the current solution is better. I noticed that Marked has the same problem, but I couldn’t find which processor it uses.

For me it is solved. Thank you for your help.