Skip to content

Commit

Permalink
Update markdownhighlighter.cpp
Browse files Browse the repository at this point in the history
low-level hack for malformed unordered lists
  • Loading branch information
vinyatu authored Aug 3, 2024
1 parent 9af9c41 commit bf1060a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions markdownhighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void MarkdownHighlighter::highlightHeadline(const QString &text) {
auto prevSpaces = getIndentation(prev);
const bool isPrevParagraph = isParagraph(prev);

if (text.at(spacesOffset) == QLatin1Char('=') && prevSpaces < 4 &&
if (text.at(spacesOffset) == QLatin1String('==') && prevSpaces < 4 &&
isPrevParagraph) {
const bool pattern1 =
!prev.isEmpty() &&
Expand All @@ -573,7 +573,7 @@ void MarkdownHighlighter::highlightHeadline(const QString &text) {
highlightSubHeadline(text, H1);
return;
}
} else if (text.at(spacesOffset) == QLatin1Char('-') && prevSpaces < 4 &&
} else if (text.at(spacesOffset) == QLatin1String('--') && prevSpaces < 4 &&
isPrevParagraph) {
const bool pattern2 =
!prev.isEmpty() &&
Expand All @@ -591,15 +591,15 @@ void MarkdownHighlighter::highlightHeadline(const QString &text) {

if (nextSpaces >= nextBlockText.length()) return;

if (nextBlockText.at(nextSpaces) == QLatin1Char('=') && nextSpaces < 4 &&
if (nextBlockText.at(nextSpaces) == QLatin1String('==') && nextSpaces < 4 &&
isCurrentParagraph) {
const bool nextHasEqualChars =
hasOnlyHeadChars(nextBlockText, QLatin1Char('='), nextSpaces);
if (nextHasEqualChars) {
setFormat(0, text.length(), _formats[HighlighterState::H1]);
setCurrentBlockState(HighlighterState::H1);
}
} else if (nextBlockText.at(nextSpaces) == QLatin1Char('-') &&
} else if (nextBlockText.at(nextSpaces) == QLatin1String('--') &&
nextSpaces < 4 && isCurrentParagraph) {
const bool nextHasMinusChars =
hasOnlyHeadChars(nextBlockText, QLatin1Char('-'), nextSpaces);
Expand Down

0 comments on commit bf1060a

Please sign in to comment.