Skip to content

FlexmarkHtmlParser can not handle escaped tags correctly #274

@yososs

Description

@yososs

This problem can be reproduced with the following test code.

	@Test
	public void testEscapedTag() {
		final String html = "<html><body>"
				+ "&lt;em&gt;abc&lt;/em&gt;"
				+ "<table>"
				+ "<caption>&lt;b&gt;caption&lt;/b&gt;</caption>"
				+ "<tr><th>&lt;s&gt;th&lt;/s&gt;</th></tr>"
				+ "<tr><td>&lt;u&gt;tr&lt;/u&gt;</td></tr>"
				+ "<tr><td>&lt;i&gt;tr&lt;/i&gt;</td></tr>"
				+ "<tr><td>&lt;&gt;</td></tr>"
				+ "<tr><td>\\</td></tr>"
				+ "</table>"
		+"</body></html>";

		final MutableDataSet parseOptions = new MutableDataSet();

		final String markdown = FlexmarkHtmlParser.parse(html, 20, parseOptions);

		System.out.println(html);
		System.out.println(markdown);
		
		Assert.assertTrue(markdown.contains("\\<s>"));
		Assert.assertTrue(markdown.contains("\\<u>"));
		Assert.assertTrue(markdown.contains("\\<i>"));
		Assert.assertTrue(markdown.contains("\\\\"));
	}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions