Skip to content

Commit

Permalink
#3218 schema: fix QTextBrowser strong and em combination issue
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Jan 28, 2025
1 parent 3290ea4 commit ff72add
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 25.1.6
- The available AI models for Groq have been updated
(for [#3216](https://github.com/pbek/QOwnNotes/issues/3216), thank you, @Weej1)
- An issue with combinations or strong and em tags preview was fixed
(for [#3218](https://github.com/pbek/QOwnNotes/issues/3218))

## 25.1.5
- After moving a note to a new subfolder, outgoing links to other notes can now be
Expand Down
15 changes: 12 additions & 3 deletions src/utils/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,17 @@ QString Utils::Schema::getSchemaStyles() {
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::H5, QStringLiteral("h5"));
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::H6, QStringLiteral("h6"));
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::Link, QStringLiteral("a"));
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::Bold, QStringLiteral("b, strong"));
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::Italic, QStringLiteral("i, em"));

// We are adding also style combinations for bold and italic, because QTextBrowser doesn't
// inherit the styles correctly (https://github.com/pbek/QOwnNotes/issues/3218)
schemaStyles += encodeCssStyleForState(
MarkdownHighlighter::Bold,
QStringLiteral(
"b, strong, i b, em b, i strong, em strong, b i, strong i, b em, strong em"));
schemaStyles += encodeCssStyleForState(
MarkdownHighlighter::Italic,
QStringLiteral("i, em, i b, em b, i strong, em strong, b i, strong i, b em, strong em"));

schemaStyles += encodeCssStyleForState(MarkdownHighlighter::CodeBlock,
QStringLiteral("code, pre > code, pre"));
schemaStyles += encodeCssStyleForState(MarkdownHighlighter::InlineCodeBlock,
Expand Down Expand Up @@ -463,7 +472,7 @@ QString Utils::Schema::encodeCssStyleForState(MarkdownHighlighter::HighlighterSt

// Allow italic inside bold tags, like `**bold *and italic***`
// https://github.com/pbek/QOwnNotes/issues/3218
// Unfortunately, the QTextBrowser still doesn't render it correctly
// Unfortunately, that's not enough for the QTextBrowser to render it correctly
if (index == MarkdownHighlighter::Italic) {
cssString.remove(QStringLiteral("font-weight: normal;"));
}
Expand Down

0 comments on commit ff72add

Please sign in to comment.