diff --git a/src/calibre/gui2/markdown_syntax_highlighter.py b/src/calibre/gui2/markdown_syntax_highlighter.py index f62c714588..7079ac6185 100644 --- a/src/calibre/gui2/markdown_syntax_highlighter.py +++ b/src/calibre/gui2/markdown_syntax_highlighter.py @@ -99,10 +99,8 @@ class MarkdownHighlighter(QSyntaxHighlighter): format = QTextCharFormat() if 'color' in subtheme: format.setForeground(QBrush(QColor(subtheme['color']))) - if 'font-weight' in subtheme: - format.setFontWeight(QFont.Weight.Bold if subtheme['font-weight']=='bold' else QFont.Weight.Normal) - if 'font-style' in subtheme: - format.setFontItalic(True if subtheme['font-style']=='italic' else False) + format.setFontWeight(QFont.Weight.Bold if subtheme.get('font-weight') == 'bold' else QFont.Weight.Normal) + format.setFontItalic(subtheme.get('font-style') == 'italic') self.MARKDOWN_KWS_FORMAT[k] = format self.rehighlight()