Skip to content

Commit 59a6f13

Browse files
committed
Update writing text inside tables in markdown
1 parent c418363 commit 59a6f13

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/markdown/MarkdownGenerator.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ protected void writeList(PDFList list) throws IOException {
152152
}
153153

154154
protected void writeSemanticTextNode(SemanticTextNode textNode) throws IOException {
155-
markdownWriter.write(getCorrectMarkdownString(textNode.getValue()));
155+
String value = textNode.getValue();
156+
if (isInsideTable() && StaticContainers.isKeepLineBreaks()) {
157+
value = value.replace(MarkdownSyntax.LINE_BREAK, getLineBreak());
158+
}
159+
160+
markdownWriter.write(getCorrectMarkdownString(value));
156161
}
157162

158163
protected void writeTable(TableBorder table) throws IOException {
@@ -194,12 +199,7 @@ protected void writeContents(List<IObject> contents) throws IOException {
194199
}
195200

196201
protected void writeParagraph(SemanticParagraph textNode) throws IOException {
197-
String value = textNode.getValue();
198-
if (isInsideTable() && StaticContainers.isKeepLineBreaks()) {
199-
value = value.replace(MarkdownSyntax.LINE_BREAK, getLineBreak());
200-
}
201-
202-
markdownWriter.write(getCorrectMarkdownString(value));
202+
writeSemanticTextNode(textNode);
203203
}
204204

205205
protected void writeHeading(SemanticHeading heading) throws IOException {
@@ -210,7 +210,7 @@ protected void writeHeading(SemanticHeading heading) throws IOException {
210210
}
211211
markdownWriter.write(MarkdownSyntax.SPACE);
212212
}
213-
markdownWriter.write(getCorrectMarkdownString(heading.getValue()));
213+
writeSemanticTextNode(heading);
214214
}
215215

216216
protected void enterTable() {

0 commit comments

Comments
 (0)