From 4a6779c16c1a9bf1389b3ed78d6d93d4b3ae0cc0 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 22 Apr 2019 21:15:00 +0200 Subject: [PATCH] Fixed the syntax regex to do markdown bold/italic properly, and support quote styles in config --- nw/gui/dochighlight.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index 842f7d5c..da0db3db 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -50,21 +50,25 @@ class GuiDocHighlighter(QSyntaxHighlighter): } self.hRules = [ - (r"^#{1}[^#].*[^\n]", 0, self.hStyles["header1"]), - (r"^#{2}[^#].*[^\n]", 0, self.hStyles["header2"]), - (r"^#{3}[^#].*[^\n]", 0, self.hStyles["header3"]), - (r"^#{4}[^#].*[^\n]", 0, self.hStyles["header4"]), - (r"\*{2}(.+?)\*{2}", 0, self.hStyles["bold"]), - (r"\/{2}(.+?)\/{2}", 0, self.hStyles["italic"]), - (r"~{2}(.+?)~{2}", 0, self.hStyles["strike"]), - (r"_{2}(.+?)_{2}", 0, self.hStyles["underline"]), - (r'"(.+?)"', 0, self.hStyles["dialogue"]), - (r"«(.+?)»", 0, self.hStyles["dialogue"]), - (r"“(.+?)”", 0, self.hStyles["dialogue"]), + (r"^#{1}[^#].*[^\n]", 0, self.hStyles["header1"]), + (r"^#{2}[^#].*[^\n]", 0, self.hStyles["header2"]), + (r"^#{3}[^#].*[^\n]", 0, self.hStyles["header3"]), + (r"^#{4}[^#].*[^\n]", 0, self.hStyles["header4"]), + (r"(?