I found a partial workaround for excluding section headings using the Display Macro. While it doesn’t cover all use cases, it might help until XWIKI-18687 is resolved.
The workaround simply sets display: none !important;
for <br>
. However, this approach is only viable if there are no regular <br>
sections in either the including page or the included page/sections.
Sandbox.ExcludeHeading.SomePage.WebHome
= Heading 1 =
Text for Heading 1
= Heading-2 =
Text for Heading-2
Display content of SomePage in another page
{{display reference="Sandbox.ExcludeHeading.SomePage.WebHome"
excludeFirstHeading="true" section="HHeading1"/}}
{{display reference="Sandbox.ExcludeHeading.SomePage.WebHome"
excludeFirstHeading="true" section="HHeading-2"/}}
Result:
1
Text for Heading 1-2
Text for Heading-2
Fix to display content of SomePage in another page
{{html clean="false"}}
<style>
p:has(br) {
display: none !important;
}
</style>
{{/html}}
{{display reference="Sandbox.ExcludeHeading.SomePage.WebHome"
excludeFirstHeading="true" section="HHeading1"/}}
{{html clean="false"}}
<style>
p:has(br) {
display: none !important;
}
</style>
{{/html}}
{{display reference="Sandbox.ExcludeHeading.SomePage.WebHome"
excludeFirstHeading="true" section="HHeading-2"/}}
{{html}}<p><br>Also disappears</p>{{/html}}
Result:
Text for Heading 1
Text for Heading-2
2 posts - 2 participants