flexmark-java
flexmark-java copied to clipboard
JiraConverter: P inside LIs results in separate list
Test case:
package com.vladsch.flexmark.jira.converter;
import static com.vladsch.flexmark.parser.Parser.EXTENSIONS;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.vladsch.flexmark.html.HtmlRenderer;
import com.vladsch.flexmark.parser.Parser;
import com.vladsch.flexmark.util.ast.Document;
import com.vladsch.flexmark.util.data.MutableDataSet;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
final class JiraConverterExtensionTest {
private static Document DOCUMENT;
@BeforeAll
static void setUp() {
DOCUMENT = Parser.builder().build().parse("1. a\n\n2. b");
}
@Test
void renderHtml() {
final String htmlText = HtmlRenderer.builder().build().render(DOCUMENT);
assertEquals("<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n</ol>\n", htmlText);
}
@Test
void renderJira() {
final String jiraText =
HtmlRenderer.builder(
new MutableDataSet()
.set(EXTENSIONS, singletonList(JiraConverterExtension.create())))
.build()
.render(DOCUMENT);
assertEquals("# a\n# b\n", jiraText);
}
}
The HTML rendering is fine, but the JIRA rendering is not; instead of a single list with two list items:
# a
# b
…two lists are generated, both with a single list item:
# a
# b
It looks like this should be addressed in the JiraConverterNodeRenderer class.