File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -157,20 +157,20 @@ class ReTextHighlighter(QSyntaxHighlighter):
157
157
)
158
158
159
159
def highlightBlock (self , text ):
160
+ # If inside fenced code block (not the fence line)
160
161
if self .docType == 'Markdown' and self .previousBlockState () == 1 :
162
+ fmt = QTextCharFormat ()
163
+ fmt .setFontItalic (True )
164
+
161
165
# Check if this line closes fenced block
162
166
if reFencedCodeEnd .match (text ):
163
167
# Fence closes: highlight fence line in yellowgreen (codeSpans)
164
- fmt = QTextCharFormat ()
165
168
fmt .setForeground (getColor ('codeSpans' )) # fence color yellowgreen
166
- fmt .setFontItalic (True )
167
169
self .setFormat (0 , len (text ), fmt )
168
170
self .setCurrentBlockState (0 )
169
171
else :
170
172
# Inside fenced code: highlight in orange (codeBlock)
171
- fmt = QTextCharFormat ()
172
173
fmt .setForeground (getColor ('codeBlock' )) # code block content color orange
173
- fmt .setFontItalic (True )
174
174
self .setFormat (0 , len (text ), fmt )
175
175
self .setCurrentBlockState (1 )
176
176
return
You can’t perform that action at this time.
0 commit comments