Skip to content

Incorrect footnote link #75

@zhenyuluo

Description

@zhenyuluo

Hi,

I found that when line separator is \r\n, the footnote link can't be rendered correctly.

Below is my test:

public static String toHtml(String raw) {
        MutableDataHolder options = new MutableDataSet();
        List<Extension> extensions = Lists.newArrayList();
        options.set(Parser.EXTENSIONS, extensions);

        // change soft break to hard break
        options.set(HtmlRenderer.SOFT_BREAK, "<br/>");

        Parser parser = Parser.builder(options).build();
        Node document = parser.parse(raw);
        HtmlRenderer renderer = HtmlRenderer.builder(options).build();
        return renderer.render(document);
    }

    public static void main(String[] args) {
        String str = "Incorrect: [amazon][2]\r\n" +
                "\r\n" +
                "[1]: http://www.google.com/\r\n" +
                "[2]: http://www.amazon.com/";
        System.out.println(toHtml(str));
    }

the output is:

<p>Incorrect: [amazon][2]</p>
<p>[1]: http://www.google.com/<br/>[2]: http://www.amazon.com/</p>

If the line separator is \n, then everything is fine.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions