Project

General

Profile

Actions

Defect #44057

open

Backport fix for #42332 (HEADING_RE missing /m flag) to 5.1-stable

Added by ilkwon jung about 2 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Resolution:
Affected version:

Description

#42332 ("Edit this section" button is missing for headings rendered as multiline HTML) was fixed for 6.0.6 in r23802 / r23804 by adding the `/m` flag to `HEADING_RE` in `app/helpers/application_helper.rb`.

The same root cause also produces the following user-visible symptoms, which are not mentioned in the original ticket:

- Headings containing inline markup (italic, inline code, strong, links) are silently omitted from the `{{toc}}` macro output.
- The corresponding heading anchor IDs (`#heading-name`) are not generated, breaking intra-page links and cross-page deep links.

All three symptoms (missing edit pencil, missing TOC entry, missing anchor) share a single trigger: the CommonMark formatter emits multi-line HTML for headings that contain inline elements, e.g.


<h5>Heading with
<em>italic</em>
inside</h5>

and `(.+?)` in the pre-fix `HEADING_RE` does not cross `\n` in Ruby without the `/m` flag.

Request

Please consider backporting r23802 to 5.1-stable. The change is a single-character modification (`/i` → `/im`) with no behavioral side effects beyond the intended fix; the existing test added in 42332-test.patch covers it.

Reproduction

Same setup as #42332. To additionally confirm the TOC symptom, place `{{toc}}` on the same page and observe that headings containing `_italic_` or `` `code` `` are missing from the rendered table of contents in 5.1.x.

Environment

- Redmine version: 5.1.x
- Text formatting: common_mark (GFM)
- Related ticket: #42332 (Closed, Fixed in 6.0.6)

No data to display

Actions

Also available in: Atom PDF