Defect #40918
openWiki (markdown syntax): "Edit this section" does not extract SeText headings correctly
0%
Description
Abstraction¶
"Edit this section" in Wiki with the Markdown syntax does not extract setext headings correctly.
This issue is an extension of defect #40716 that we discovered when researching the issue we experience with Redmine 5.1.2.stable. Please see that other ticket first.
How to reproduce¶
Prepare Wiki with the Markdown syntax as follows.
A new MarkDown page =================== This text is the first section. First subsection ---------------- Here would be a first subsection Second subsection ----------------- Here would be a second subsection
The page should look like this:
To reproduce the error, click on one of the two "Edit this section" button next to one of the subheadings (URLs end in "/edit?section=2" and "/edit?section=3"), highlighted with red circles in the screenshot above. For both buttons/links, I get an "404 The page you were trying to access doesn't exist or has been removed." like in the following screenshot:
This seems to be related to the fact reported in defect #40716 that Redmine currently parses the headings using an incomplete regular expression. The other ticket provides a fix to correctly disambiguate ticket links and ATX headings, but the issue is broader because the regex does not even consider setext headings.
Both are allowed variants in MarkDown and are also described in examples in the Redmine formatting help (for MarkDown).
How should we fix this?¶
I'm citing the other ticket her:
It would be necessary to improve the regular expression based on "GitHub Flavored Markdown" (because the commonmarker is wrapping comrak, and comrak is based on GitHub Flavored Markdown.)
I'm sorry I cannot provide a patch or pull request here.
Files