Skip to content
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

Problem with escaping < and > #22

Open
myabc opened this issue Nov 18, 2013 · 1 comment
Open

Problem with escaping < and > #22

myabc opened this issue Nov 18, 2013 · 1 comment

Comments

@myabc
Copy link
Owner

myabc commented Nov 18, 2013

From [email protected] 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&gt;x</code> foo <code>y&lt;x` bar `y&gt;x</code></p>

and

<p><code>y&gt;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

@myabc
Copy link
Owner Author

myabc commented Nov 18, 2013

From alex.coles on February 18, 2013 16:29:47

Status: Accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant