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.

Pick-to: 6.2 6.5 6.6 6.6.2 6.7
Change-Id: I5a4bf8720d994616274eb8534b4d7085399130fc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3bd4c1b670b8b973e8a782bcaec7078027f6ea36)
This commit is contained in:
Shawn Rutledge 2024-01-23 23:55:46 -07:00
parent 4055c760f2
commit abc097a32e

View File

@ -11,6 +11,7 @@ stars
stars with tabs between
***
stars with whitespace after
---
hyphens with whitespace after
_____