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 HTMLResulting HTML
POST https://<redmine>/issues/preview?project_id=<project_id>
text: "1+{{collapse(1)1}}2+{{collapse(2)2}}3+{{collapse(3)3}}"
<p>1 <a href="#" onclick="$('#collapse-0fd54bb3-show, #collapse-0fd54bb3-hide').toggle(); $('#collapse-0fd54bb3').fadeToggle(150);; return false;" id="collapse-0fd54bb3-show" class="icon icon-collapsed collapsible"><svg class="s18 icon-svg icon-rtl" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use></svg><span class="icon-label">1</span></a><a href="#" onclick="$('#collapse-0fd54bb3-show, #collapse-0fd54bb3-hide').toggle(); $('#collapse-0fd54bb3').fadeToggle(150);; return false;" id="collapse-0fd54bb3-hide" class="icon icon-expanded collapsible" style="display:none;"><svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use></svg><span class="icon-label">1</span></a><div id="collapse-0fd54bb3" class="collapsed-text" style="display:none;"><p>1</p></div><br />2 <a href="#" onclick="$('#collapse-d88bfe47-show, #collapse-d88bfe47-hide').toggle(); $('#collapse-d88bfe47').fadeToggle(150);; return false;" id="collapse-d88bfe47-show" class="icon icon-collapsed collapsible"><svg class="s18 icon-svg icon-rtl" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use></svg><span class="icon-label">2</span></a><a href="#" onclick="$('#collapse-d88bfe47-show, #collapse-d88bfe47-hide').toggle(); $('#collapse-d88bfe47').fadeToggle(150);; return false;" id="collapse-d88bfe47-hide" class="icon icon-expanded collapsible" style="display:none;"><svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use></svg><span class="icon-label">2</span></a><div id="collapse-d88bfe47" class="collapsed-text" style="display:none;"><p>2</p></div><br />3 <a href="#" onclick="$('#collapse-64af7d61-show, #collapse-64af7d61-hide').toggle(); $('#collapse-64af7d61').fadeToggle(150);; return false;" id="collapse-64af7d61-show" class="icon icon-collapsed collapsible"><svg class="s18 icon-svg icon-rtl" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use></svg><span class="icon-label">3</span></a><a href="#" onclick="$('#collapse-64af7d61-show, #collapse-64af7d61-hide').toggle(); $('#collapse-64af7d61').fadeToggle(150);; return false;" id="collapse-64af7d61-hide" class="icon icon-expanded collapsible" style="display:none;"><svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use></svg><span class="icon-label">3</span></a><div id="collapse-64af7d61" class="collapsed-text" style="display:none;"><p>3</p></div></p>
Formatted HTMLFormatted HTML
Formatting may not be fully correct because of invalid HTML structure (because of this bug).
<p>
1
<a href="#" onclick="$('#collapse-0fd54bb3-show, #collapse-0fd54bb3-hide').toggle(); $('#collapse-0fd54bb3').fadeToggle(150);; return false;" id="collapse-0fd54bb3-show" class="icon icon-collapsed collapsible">
<svg class="s18 icon-svg icon-rtl" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use>
</svg>
<span class="icon-label">1</span>
</a>
<a href="#" onclick="$('#collapse-0fd54bb3-show, #collapse-0fd54bb3-hide').toggle(); $('#collapse-0fd54bb3').fadeToggle(150);; return false;" id="collapse-0fd54bb3-hide" class="icon icon-expanded collapsible" style="display:none;">
<svg class="s18 icon-svg" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use>
</svg>
<span class="icon-label">1</span>
</a>
<div id="collapse-0fd54bb3" class="collapsed-text" style="display:none;">
<p>1</p>
</div>
<br />2
<a href="#" onclick="$('#collapse-d88bfe47-show, #collapse-d88bfe47-hide').toggle(); $('#collapse-d88bfe47').fadeToggle(150);; return false;" id="collapse-d88bfe47-show" class="icon icon-collapsed collapsible">
<svg class="s18 icon-svg icon-rtl" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use>
</svg>
<span class="icon-label">2</span>
</a>
<a href="#" onclick="$('#collapse-d88bfe47-show, #collapse-d88bfe47-hide').toggle(); $('#collapse-d88bfe47').fadeToggle(150);; return false;" id="collapse-d88bfe47-hide" class="icon icon-expanded collapsible" style="display:none;">
<svg class="s18 icon-svg" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use>
</svg>
<span class="icon-label">2</span>
</a>
<div id="collapse-d88bfe47" class="collapsed-text" style="display:none;">
<p>2</p>
</div>
<br />3
<a href="#" onclick="$('#collapse-64af7d61-show, #collapse-64af7d61-hide').toggle(); $('#collapse-64af7d61').fadeToggle(150);; return false;" id="collapse-64af7d61-show" class="icon icon-collapsed collapsible">
<svg class="s18 icon-svg icon-rtl" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-right"></use>
</svg>
<span class="icon-label">3</span>
</a>
<a href="#" onclick="$('#collapse-64af7d61-show, #collapse-64af7d61-hide').toggle(); $('#collapse-64af7d61').fadeToggle(150);; return false;" id="collapse-64af7d61-hide" class="icon icon-expanded collapsible" style="display:none;">
<svg class="s18 icon-svg" aria-hidden="true">
<use href="/assets/icons-64cb2f36.svg#icon--angle-down"></use>
</svg>
<span class="icon-label">3</span>
</a>
<div id="collapse-64af7d61" class="collapsed-text" style="display:none;">
<p>3</p>
</div>
</p>
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 11
2
223
33
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:
11
22
33
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 11
2
223
33
4 44
5
556
66
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 11
2 22
3 33
Screenshot:

Example 5: Workaround 2 (list - correct)¶
* 1 {{collapse(1)
1
}}
* 2 {{collapse(2)
2
}}
* 3 {{collapse(3)
3
}}
Result:
Screenshot:
