Merge branch 'main' into unicode_fix
This commit is contained in:
@@ -113,6 +113,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
self._addCharFormat("bold", colEmph, "b")
|
||||
self._addCharFormat("italic", colEmph, "i")
|
||||
self._addCharFormat("strike", syntax.hidden, "s")
|
||||
self._addCharFormat("mark", syntax.mark, "bg")
|
||||
self._addCharFormat("mspaces", syntax.error, "err")
|
||||
self._addCharFormat("nobreak", colBreak, "bg")
|
||||
self._addCharFormat("altdialog", syntax.dialA)
|
||||
@@ -200,6 +201,17 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
self._txtRules.append((rxRule, hlRule))
|
||||
self._cmnRules.append((rxRule, hlRule))
|
||||
|
||||
# Markdown Highlight
|
||||
rxRule = REGEX_PATTERNS.markdownMark
|
||||
hlRule = {
|
||||
1: self._hStyles["markup"],
|
||||
2: self._hStyles["mark"],
|
||||
3: self._hStyles["markup"],
|
||||
}
|
||||
self._minRules.append((rxRule, hlRule))
|
||||
self._txtRules.append((rxRule, hlRule))
|
||||
self._cmnRules.append((rxRule, hlRule))
|
||||
|
||||
# Shortcodes
|
||||
rxRule = QRegularExpression(REGEX_PATTERNS.shortcodePlain.pattern, RX_UNICODE)
|
||||
hlRule = {
|
||||
@@ -460,9 +472,6 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
blockMerge = name == "markup"
|
||||
charFormat.setProperty(QtTextUserProperty, blockMerge)
|
||||
|
||||
if color:
|
||||
charFormat.setForeground(color)
|
||||
|
||||
if style:
|
||||
styles = style.split(",")
|
||||
if "b" in styles:
|
||||
@@ -478,6 +487,10 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
charFormat.setUnderlineStyle(QTextCharFormat.UnderlineStyle.SpellCheckUnderline)
|
||||
if "bg" in styles and color is not None:
|
||||
charFormat.setBackground(QBrush(color, Qt.BrushStyle.SolidPattern))
|
||||
color = None
|
||||
|
||||
if color:
|
||||
charFormat.setForeground(color)
|
||||
|
||||
if size:
|
||||
charFormat.setFontPointSize(round(size*CONFIG.textFont.pointSize()))
|
||||
|
||||
Reference in New Issue
Block a user