Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-24634

Adding Header in Rendered body 'User Macro' doesn't work if you put paragraph content after the header

XMLWordPrintable

      Problem Description

      When we try to add header in User Macro that has option rendered body, it will not appear in Page and also html source of the page, despite when you click View Source or View Storage Format from the page, all the header will appear there. If you click view source from web browser, you will find that the header is actually missing from the div tag.

      Steps to Reproduce

      1. Create 'User Macro' from Admin Console and choose Rendered as its Macro Body Processing.
      2. Add this simple div in the template of user macro.
        <div class="sample">$body</div>
        
      3. Add the user macro to any page
      4. Add header to the body of macro
      5. Add any Paragraph content on the next line after the header.
        Note: If you press Enter on paragraph format content the header will be rendered, but if you press Shift + Enter the header won't be rendered again.
      6. The header will not be rendered in Page despite it's being displayed in View Source and View Storage Format.

      Screenshots and Storage format

      How it's rendered in page

      View Storage Format

      <ac:macro ac:name="sample"><ac:parameter ac:name="Name">sample macro</ac:parameter><ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter><ac:rich-text-body>
      <h1>Heading 1</h1>
      <h2>Heading 2</h2>
      <h4>Heading 4</h4>
      <p>Paragraph</p></ac:rich-text-body></ac:macro>
      

      View Source

      Workaround

      Add a Dummy Paragraph after the desired paragraph. This can be a white space after a line break at the end. This has to have the paragraph formatting.
      Keep in mind that when adding text to body the default formatting is paragraph. If you selected the added text and click paragraph, it will actually remove the needed formatting.

        1. usermacro-2.png
          usermacro-2.png
          15 kB
        2. usermacro-1.png
          usermacro-1.png
          13 kB
        3. confluence1.png
          confluence1.png
          47 kB
        4. confluence2.png
          confluence2.png
          76 kB

              Unassigned Unassigned
              rjmasikome RianA
              Votes:
              33 Vote for this issue
              Watchers:
              27 Start watching this issue

                Created:
                Updated: