diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-01-23 23:55:46 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-01-25 16:18:11 +0000 |
commit | 3fa20b8e55eb5815deb01c064c58769173088f63 (patch) | |
tree | b9a1807c31e352dc583529bf5a051a2aa8e04af5 | |
parent | 1e31dad8a2c4d908f2435947af87c63d7922a2a5 (diff) |
Avoid detection of heading in tst_QTextMarkdownImporter::thematicBreaks
In md4c 0.4.8, three or more hyphens immediately after text were seen as
a thematic break:
some text
---
But in 0.5.1 it makes the text into an H2 heading (even though this
style of heading would normally have the text fully "underlined" with
hyphens). The CommonMark spec 0.30 says
If a line of dashes that meets the above conditions for being a
thematic break could also be interpreted as the underline of a setext
heading, the interpretation as a setext heading takes precedence.
Thus, for example, this is a setext heading, not a paragraph followed
by a thematic break:
https://spec.commonmark.org/0.30/#example-59
So the new behavior seems more correct. But rather than testing so
deeply, just disambiguate by adding a newline, since Qt may be expected
to work with various versions of md4c, and such minor behavior
differences are not expected to come up often in practice.
QTextMarkdownWriter already adds a newline when writing such markdown.
Change-Id: I5a4bf8720d994616274eb8534b4d7085399130fc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3bd4c1b670b8b973e8a782bcaec7078027f6ea36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2f5fe6a9a10f967622f9831e4bd06d633f105e20)
(cherry picked from commit 9aedd9413b1543699d24f80a0ebc91e052bf037a)
-rw-r--r-- | tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md b/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md index 7a0d5388ad..e784879326 100644 --- a/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md +++ b/tests/auto/gui/text/qtextmarkdownimporter/data/thematicBreaks.md @@ -11,6 +11,7 @@ stars stars with tabs between *** stars with whitespace after + --- hyphens with whitespace after _____ |