improved markdown support in table generator
This commit is contained in:
parent
14cc22f9a2
commit
49fbc739fd
|
@ -240,6 +240,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
pieces.add(piece);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Cell addMarkdown(String md) {
|
||||
try {
|
||||
Parser parser = Parser.builder().build();
|
||||
|
@ -253,6 +254,19 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Cell addMarkdownNoPara(String md) {
|
||||
try {
|
||||
Parser parser = Parser.builder().build();
|
||||
Node document = parser.parse(md);
|
||||
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
|
||||
String html = renderer.render(document);
|
||||
pieces.addAll(htmlToParagraphPieces(html));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private List<Piece> htmlToParagraphPieces(String html) {
|
||||
List<Piece> myPieces = new ArrayList<Piece>();
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue