Headings are not numbered with include macro and Confluence 5

Issue #17 new
Stephan Vollmer created an issue

Hi,

i use Numbered Headings 2.2.0 with Confluence 5.0.1. Now the numbered headings are missing when a page is embedded into another page with the "Include Page" macro.

Steps to reproduce:

  1. Create a page called "Page 1" with the Numbered Headings macro and a few headings inside the macro body.

  2. Create a page called "Page 2". Insert the "Include Page" macro and choose "Page 1" as the included page.

Result:

When "Page 1" is displayed, then the headings are numbered. When "Page 2" is displayed, then the headings are not numbered.

According to my colleague, this worked in Confluence 4.3.7. Is this new behaviour intended or is it possibly a bug?

As a workaround, we could wrap all "Include Page" macros in a "Numbered Headings" macro. Then the numbered headings reappear. But we have many such pages and it would be a lot of work to find and change all affected pages.

Cheers, Stephan

Comments (4)

  1. Tomas Theunissen

    I would expect the same result as you do (rendered headings when viewing page 2). But we don't render NH macros when they are included in another page, because this can cause headings to be numbered twice. The code that checks this;

    // Do not render if this macro is in a included page
    if (isPageIncluded(conversionContext)) {
      return macroBody;
    } else {
      return render(parameters, macroBody, conversionContext);
    }
    

    This code has been in NH for a long time, so I find it weird that this worked before (according to your colleague). I tested it in a 4.3.x version of Confluence and it displays the same behavior.

    There have been some changes to rendering includes/multiple pages when exporting, but that shouldn't have affect on this (to be certain ill have to check with a previous version of NH).

    I'll have to think of something that won't render heading multiple times and fixes this issue...

  2. Log in to comment