@@ -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