-
Notifications
You must be signed in to change notification settings - Fork 99
Description
From t.j.bent...@gmail.com on November 21, 2011 12:31:11
Found a bug in markdownj compiled from trunk.
Here's class to reproduce it:
import com.petebevin.markdown.MarkdownProcessor;
public class Foo {
public static void main(String[] args) {
System.out.println(new MarkdownProcessor().markdown(
"`y>x` foo `y<x` bar `y>x`"));
System.out.println(new MarkdownProcessor().markdown(
"`y>x` foo\n`y<x` bar\n`y>x`\n"));
}
}
The printed strings are
<p><code>y>x</code> foo <code>y<x` bar `y>x</code></p>
and
<p><code>y>x</code> foo
`y<x` bar
`y>x`</p>
I tracked the problem down to runSpanGamut() and escapeSpecialCharsWithinTagAttributes(). The latter tried to get text between < and > and replace special chars within those tokens, but the tokenizing is going wrong.
I noticed that in the original markdown runSpanGamut() does the code spans first and then does the special chars, so unless they've been swapped for some other reason, that's probably the way to fix it. Otherwise TextEditor.tokenizeHTML() will need to do a better job.
I've previously reported this to alex via email, but got no response.
Original issue: http://code.google.com/p/markdownj/issues/detail?id=19