highlighter: bug fix about HTML comments inside a fenced code block

This commit is contained in:
Le Tan 2018-06-04 20:50:59 +08:00
parent a2670903cf
commit d59a1010c5

View File

@ -169,8 +169,13 @@ void HGMarkdownHighlighter::highlightBlock(const QString &text)
// Set current block's user data. // Set current block's user data.
updateBlockUserData(blockNum, text); updateBlockUserData(blockNum, text);
int preState = previousBlockState();
bool inCodeblock = preState == HighlightBlockState::CodeBlock
|| preState == HighlightBlockState::CodeBlockStart;
// If it is a block inside HTML comment, just skip it. // If it is a block inside HTML comment, just skip it.
if (isBlockInsideCommentRegion(curBlock)) { // Pay attention to distinguish the HTML comments inside a fenced code block.
if (!inCodeblock && isBlockInsideCommentRegion(curBlock)) {
setCurrentBlockState(HighlightBlockState::Comment); setCurrentBlockState(HighlightBlockState::Comment);
goto exit; goto exit;
} }