Project

General

Profile

Actions

Defect #40918

open

Wiki (markdown syntax): "Edit this section" does not extract SeText headings correctly

Added by Mark Asbach 5 months ago. Updated 5 months ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

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:

Screenshot of the rendered wiki page with affected buttons highlighted

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:

Screenshot of the error page

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

rendered_page.png (141 KB) rendered_page.png Screenshot of the rendered wiki page with affected buttons highlighted Mark Asbach, 2024-06-27 11:41
error_message.png (48.7 KB) error_message.png Screenshot of the error page Mark Asbach, 2024-06-27 11:41
Actions #1

Updated by Go MAEDA 5 months ago

  • Status changed from New to Confirmed
Actions

Also available in: Atom PDF