Project

General

Profile

Actions

Defect #43730

open

Redmine generates invalid HTML when there are multiple `collapse` macros in one paragraph in Textile

Added by Artem Varaksa 22 days ago. Updated about 6 hours ago.

Status:
Confirmed
Priority:
Normal
Category:
Text formatting
Resolution:
Affected version:

Description

The issue has been observed last year on around January 21, 2025, though the behavior has been noted earlier. It's reproducible in the Redmine version on redmine.org and on 6+ versions as well.

Example 1 (one group - incorrect) + description

1 {{collapse(1)
1
}}
2 {{collapse(2)
2
}}
3 {{collapse(3)
3
}}

Resulting HTML

Formatted HTML

Validation with https://validator.w3.org/nu/#textarea highlights the following main issue:

Browsers fix these kinds of HTML issues (in this case, by opening the "p" tag in the end before its closure), but this is not the intended markup. All of these collapses should be inside a single "p" tag.

In Redmine, the result is this:

1 1


2 2
3 3

Screenshot:

I.e. the first collapse in a group is separated from others by a big blank space.

Workaround 1: splitting collapses by newlines. However, this results in a different markup - between each collapse, there will be a blank space (though, a smaller one) - and it's impossible to group several collapses together in one logical section.

Workaround 2: using a list. However, this is also a different markup that may not be always applicable and it increases logical complexity of the formatting.

See more examples below.

Example 2 (without extra text - incorrect)

{{collapse(1)
1
}}
{{collapse(2)
2
}}
{{collapse(3)
3
}}

Result:

1

2 3

Screenshot:

Example 3 (several groups - incorrect)

1 {{collapse(1)
1
}}
2 {{collapse(2)
2
}}
3 {{collapse(3)
3
}}

4 {{collapse(4)
4
}}
5 {{collapse(5)
5
}}
6 {{collapse(6)
6
}}

Result:

1 1


2 2
3 3

4 4


5 5
6 6

Screenshot:

Example 4: Workaround 1 (all separate - correct, but impossible to group)

1 {{collapse(1)
1
}}

2 {{collapse(2)
2
}}

3 {{collapse(3)
3
}}

Result:

1 1

2 2

3 3

Screenshot:

Example 5: Workaround 2 (list - correct)

* 1 {{collapse(1)
1
}}
* 2 {{collapse(2)
2
}}
* 3 {{collapse(3)
3
}}

Result:

Screenshot:


Files

Actions

Also available in: Atom PDF