escape bare html entities

This commit is contained in:
Grahame Grieve 2022-09-20 04:52:20 -04:00
parent 689b9a57b1
commit 72b3d2f6d1
2 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ public class MarkDownProcessor {
Set<Extension> extensions = Collections.singleton(TablesExtension.create()); Set<Extension> extensions = Collections.singleton(TablesExtension.create());
Parser parser = Parser.builder().extensions(extensions).build(); Parser parser = Parser.builder().extensions(extensions).build();
Node document = parser.parse(source); Node document = parser.parse(source);
HtmlRenderer renderer = HtmlRenderer.builder().extensions(extensions).build(); HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).extensions(extensions).build();
String html = renderer.render(document); String html = renderer.render(document);
html = html.replace("<table>", "<table class=\"grid\">"); html = html.replace("<table>", "<table class=\"grid\">");
return html; return html;

View File

@ -111,12 +111,12 @@
<dependency> <dependency>
<groupId>com.atlassian.commonmark</groupId> <groupId>com.atlassian.commonmark</groupId>
<artifactId>commonmark</artifactId> <artifactId>commonmark</artifactId>
<version>0.12.1</version> <version>0.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.atlassian.commonmark</groupId> <groupId>com.atlassian.commonmark</groupId>
<artifactId>commonmark-ext-gfm-tables</artifactId> <artifactId>commonmark-ext-gfm-tables</artifactId>
<version>0.12.1</version> <version>0.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.rjeschke</groupId> <groupId>com.github.rjeschke</groupId>