Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-77751

Confluence Cloud excerpt macro produces invalid HTML in view and export_view render modes

XMLWordPrintable

      When using the excerpt macro with multiple lines, the macro produces invalid HTML when rendered in view or export_view modes.

      Steps to reproduce:

      1. Create a new page
      1. Insert a standard paragraph with some text
      1. In the next line insert an excerpt macro with two lines of content (linebreak between these lines)
      1. Add another paragraph after the macro
      1. See attached screenshot from the editor for comparison.
      1. Get the view and export_view representation via REST API:
        1. Open <CONFLUENCE_BASE_URL>/wiki/rest/api/content/<PAGE_ID>?expand=body.storage,body.view,body.export_view in the same browser.

       

      As you'll see the storage format has proper paragraphs around each line (both in and outside the macro):

       

      <p>Below is an excerpt.</p>
      <ac:structured-macro ac:name="excerpt" ...>
          <ac:rich-text-body>
              <p>First line in excerpt.</p>
              <p>Second line in excerpt.</p>
          </ac:rich-text-body>
      </ac:structured-macro>
      <p>Above was the excerpt.</p>

       

      The export_view format however lost the opening <p> of the first paragraph in the macro, and the closing </p> of the second line:

      <p>Below is an excerpt.</p>
      First line in excerpt.</p>
      <p>Second line in excerpt.
      <p>Above was the excerpt.</p>

      The view format is also broken, but differently (first line text in excerpt has been moved out of the paragraph, which is now empty <p></p>):

      <p>Below is an excerpt.</p>
      <span class=\"conf-macro output-inline\" data-hasbody=\"true\" data-macro-name=\"excerpt\" data-macro-id=\"030f0358-b9d1-49dd-9326-b2b0df87434e\" data-layout=\"default\" data-local-id=\"973bec76-c955-4a63-94c2-81f6525e94f9\">
      First line in excerpt.
      <p></p>
      <p>Second line in excerpt.</p>
      </span>
      <p>Above was the excerpt.</p>

       

              Unassigned Unassigned
              9e6ef5b5b664 Rodrigo Morette
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: