title: How to render all of a page's children's content in a confluence macro
body: <p>I am trying to build a simple confluence macro that renders all of the child pages of the current parent. Essentially a cross between the existing macros: children display, and include page. I did take a look at the <a href="https://bitbucket.org/atlassian/confluence-advanced-macros-plugin/src" rel="nofollow">source code</a> for those macros, but since this is my first time developing in confluence, it was more confusing than helpful.</p>
  
  <p>Right now I am working on the execute method, and since I am new to confluence development I am not sure 100% what exactly needs to go there. </p>
  
  <p>I already read through <a href="https://developer.atlassian.com/confdev/tutorials/macro-tutorials-for-confluence/creating-a-new-confluence-macro" rel="nofollow">Atlassian's Guide to Making a new Confluence Macro</a>
  but it seems they just used html to wrap a list of properties of existing macros.</p>
  
  <p>So I decided to look at the <a href="https://developer.atlassian.com/static/javadoc/confluence/latest/reference/packages.html" rel="nofollow">API</a>, specifically <a href="https://developer.atlassian.com/static/javadoc/confluence/latest/reference/com/atlassian/confluence/pages/Page.html#getLinkWikiMarkup()" rel="nofollow">Page</a>
  I was able to get very close, the problem is, when I copy the page's bodies over I don't get the children's macros and styles that are in their pages.</p>
  
  <pre><code>    @Override
      public String execute(Map&lt;String, String&gt; parameters, String body,
              ConversionContext context) throws MacroExecutionException {
          //loop through each child page and get its content
          StringBuilder sb = new StringBuilder();
          ContentEntityObject ceo = context.getPageContext().getEntity();
          Page parent =(Page) ceo ;
          List&lt;Page&gt; children = parent.getChildren();
  
          for(Page child:children)
  
          {
            sb.append(child.getBodyAsString());
          }
  
          return sb.toString();
      }
  </code></pre>
  
  <p>How do I get all of it not just the text?</p>
  
  <p>Also I am tagging this with java since that is what the plugins are written in.</p>