Fix formatting of line breaks in headers

This commit is contained in:
Veronica Berglyd Olsen
2023-08-06 21:49:55 +02:00
parent 5bc391c6c2
commit effe7abdec
6 changed files with 27 additions and 24 deletions
+7 -7
View File
@@ -27,7 +27,7 @@ import logging
from pathlib import Path
from novelwriter.constants import nwLabels
from novelwriter.constants import nwHeadFmt, nwLabels
from novelwriter.core.project import NWProject
from novelwriter.core.tokenizer import Tokenizer
@@ -122,27 +122,27 @@ class ToMarkdown(Tokenizer):
thisPar = []
elif tType == self.T_TITLE:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"# {tHead}\n\n")
elif tType == self.T_UNNUM:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"## {tHead}\n\n")
elif tType == self.T_HEAD1:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"# {tHead}\n\n")
elif tType == self.T_HEAD2:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"## {tHead}\n\n")
elif tType == self.T_HEAD3:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"### {tHead}\n\n")
elif tType == self.T_HEAD4:
tHead = tText.replace(r"\\", "\n")
tHead = tText.replace(nwHeadFmt.BR, "\n")
tmpResult.append(f"#### {tHead}\n\n")
elif tType == self.T_SEP: