Incorrect generation of HTML when entities are positioned inside emphasis underscores
uriahcarpenter opened this issue · 3 comments
uriahcarpenter commented
This test case shows incorrect HTML generation when using entities positioned inside emphasis underscores.
__Bold™__
should appear as:
Bold™
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import org.junit.Test;
import org.tautua.markdownpapers.Markdown;
import org.tautua.markdownpapers.parser.ParseException;
import static junit.framework.Assert.assertEquals;
public class MarkdownTest
{
@Test
public void testIncorrectEntityTransform()
{
// incorrectly generates:
// <p>__Bold™__</p>
assertEquals("<p><strong>Bold™</strong></p>\n", transform("__Bold™__"));
}
@Test
public void testNoEntityTransform()
{
assertEquals("<p><strong>Bold</strong></p>\n", transform("__Bold__"));
}
@Test
public void testEntityNotWrappedTransform()
{
assertEquals("<p><strong>Bold</strong>™<em>Italics</em></p>\n", transform("__Bold__™_Italics_"));
}
private String transform(String in)
{
StringWriter out = new StringWriter();
Markdown md = new Markdown();
try
{
md.transform(new StringReader(in), out);
}
catch (ParseException e)
{
throw new RuntimeException("Error parsing Markdown", e);
}
return out.toString();
}
}
Using markdownpapers-core 1.2.7
lruiz commented
I'm sorry, not yet closed
lruiz commented
Fixed on version 1.3.0, It will be available soon through Maven repository
uriahcarpenter commented
Confirmed that 1.3.0 fixes my specific use case. Thanks!
You have, by far, the best Java Markdown library.