toptensoftware / markdowndeep

Open-source implementation of Markdown for C# and Javascript
268 stars 120 forks source link

Error matching strong tags #27

Closed otakustay closed 10 years ago

otakustay commented 12 years ago

Suppose we have a string without any spaces between words:

**A**And**B**AreAlmost**Aame**AsTheyAre**Not**ReallyDifferentCreatures.

For MarkdownDeep, it converts to a wrong HTML which is:

<p>
    <strong>A</strong>And<strong>B<strong>AreAlmost</strong>Aame</strong>AsTheyAre<strong>Not</strong>ReallyDifferentCreatures.
</p>

It seems MarkdownDeep matches the first and the last ones to create a <strong> tag, however the matching should be eager** and the write output should be:

<p>
    <strong>A</strong>And<strong>B</strong>AreAlmost<strong>Aame</strong>AsTheyAre<strong>Not</strong>ReallyDifferentCreatures.
</p>

For many culture, they don't put any spaces between words, so I assume this is a fatal issue.

toptensoftware commented 10 years ago

It's been a long time since I wrote this and I'm somewhat reluctant to change it, because a lot of thought went into it at the time - most of which I don't recall off hand, but there's a couple of notes on it here: http://www.toptensoftware.com/markdowndeep/design#ambiguous-markdown-input

That's not to say MarkdownDeep is correct - just reluctant to change it at this point.

Feedback welcome.