Process heading line breaks in the Tokenizer

This commit is contained in:
Veronica Berglyd Olsen
2024-10-23 21:18:15 +02:00
parent bfa82f6bb3
commit 560540618c
6 changed files with 25 additions and 34 deletions
+6 -6
View File
@@ -27,7 +27,7 @@ import logging
from pathlib import Path
from novelwriter.constants import nwHeadFmt, nwUnicode
from novelwriter.constants import nwUnicode
from novelwriter.core.project import NWProject
from novelwriter.formats.shared import BlockFmt, BlockTyp, T_Formats, TextFmt
from novelwriter.formats.tokenizer import Tokenizer
@@ -113,23 +113,23 @@ class ToMarkdown(Tokenizer):
lines.append(f"{tTemp}\n\n")
elif tType == BlockTyp.TITLE:
tHead = tText.replace(nwHeadFmt.BR, " - ")
tHead = tText.replace("\n", " - ")
lines.append(f"# {tHead}\n\n")
elif tType == BlockTyp.HEAD1:
tHead = tText.replace(nwHeadFmt.BR, " - ")
tHead = tText.replace("\n", " - ")
lines.append(f"# {tHead}\n\n")
elif tType == BlockTyp.HEAD2:
tHead = tText.replace(nwHeadFmt.BR, " - ")
tHead = tText.replace("\n", " - ")
lines.append(f"## {tHead}\n\n")
elif tType == BlockTyp.HEAD3:
tHead = tText.replace(nwHeadFmt.BR, " - ")
tHead = tText.replace("\n", " - ")
lines.append(f"### {tHead}\n\n")
elif tType == BlockTyp.HEAD4:
tHead = tText.replace(nwHeadFmt.BR, " - ")
tHead = tText.replace("\n", " - ")
lines.append(f"#### {tHead}\n\n")
elif tType == BlockTyp.SEP: