Add support for triple hash alt header format
This commit is contained in:
@@ -396,6 +396,8 @@ class NWIndex:
|
||||
return "H1", line[3:].strip()
|
||||
elif line.startswith("##! "):
|
||||
return "H2", line[4:].strip()
|
||||
elif line.startswith("###! "):
|
||||
return "H3", line[5:].strip()
|
||||
return "H0", ""
|
||||
|
||||
def _indexWordCounts(self, tHandle: str, text: str, sTitle: str) -> None:
|
||||
|
||||
@@ -1651,6 +1651,9 @@ class GuiDocEditor(QPlainTextEdit):
|
||||
elif text.startswith("##! "):
|
||||
temp = text[4:]
|
||||
offset = 4
|
||||
elif text.startswith("###! "):
|
||||
temp = text[5:]
|
||||
offset = 5
|
||||
elif text.startswith(">> "):
|
||||
temp = text[3:]
|
||||
offset = 3
|
||||
|
||||
@@ -300,7 +300,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
# so we force a return here
|
||||
return
|
||||
|
||||
elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "#### ")):
|
||||
elif text.startswith(("# ", "#! ", "## ", "##! ", "### ", "###! ", "#### ")):
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
|
||||
if text.startswith("# "): # Heading 1
|
||||
@@ -327,6 +327,10 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
self.setFormat(0, 3, self._hStyles["head2h"])
|
||||
self.setFormat(3, len(text), self._hStyles["header2"])
|
||||
|
||||
elif text.startswith("###! "): # Hard Scene
|
||||
self.setFormat(0, 4, self._hStyles["head3h"])
|
||||
self.setFormat(4, len(text), self._hStyles["header3"])
|
||||
|
||||
elif text.startswith("%"): # Comments
|
||||
self.setCurrentBlockState(self.BLOCK_TEXT)
|
||||
cStyle, _, cPos = processComment(text)
|
||||
|
||||
@@ -106,6 +106,9 @@ def standardCounter(text: str) -> tuple[int, int, int]:
|
||||
elif line[:4] == "##! ":
|
||||
line = line[4:]
|
||||
countPara = False
|
||||
elif line[:5] == "###! ":
|
||||
line = line[5:]
|
||||
countPara = False
|
||||
|
||||
wCount += len(line.split())
|
||||
cCount += len(line)
|
||||
|
||||
Reference in New Issue
Block a user