Skip to content

Commit 5b6806a

Browse files
committed
Fix markdown table rendering: enable TablesExtension and fix unassigned cleanup chain
1 parent 16df46d commit 5b6806a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/com/jtdev/website/service/ContentService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.jtdev.website.model.BlogMetadata;
44
import com.jtdev.website.model.PortfolioMetadata;
5+
import com.vladsch.flexmark.ext.tables.TablesExtension;
56
import com.vladsch.flexmark.html.HtmlRenderer;
67
import com.vladsch.flexmark.parser.Parser;
78
import com.vladsch.flexmark.util.ast.Node;
@@ -72,6 +73,7 @@ public String getMarkdownContent(String path) throws IOException {
7273

7374
// Parse markdown and convert to ASCII-friendly format
7475
MutableDataSet options = new MutableDataSet();
76+
options.set(Parser.EXTENSIONS, java.util.Arrays.asList(TablesExtension.create()));
7577
Parser parser = Parser.builder(options).build();
7678
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
7779

@@ -150,8 +152,8 @@ private String convertHtmlToAscii(String html, String dir) {
150152

151153
// Handle images without src
152154
text = text.replaceAll("<img[^>]*>", "[Image]");
153-
text
154155

156+
text = text
155157
// Remove any remaining HTML tags
156158
.replaceAll("<[^>]+>", "")
157159

@@ -162,8 +164,7 @@ private String convertHtmlToAscii(String html, String dir) {
162164
.replaceAll("\\n{3,}", "\n\n")
163165
.trim();
164166

165-
// The formatting is already handled in the regex replacements above
166-
return text.trim();
167+
return text;
167168
}
168169

169170
private String formatNestedLists(String html) {

0 commit comments

Comments
 (0)