iA


On converting wiki markup based user macros for use with Confluence 4

by David. Average Reading Time: about a minute.

Thomas Emil Hansen recently wrote How do I write a user macro with “sections” and “panels” using the 4.0 HTML template?

With Confluence 4, the storage format has changed from traditional wiki markup to an XML based storage format. This means that all those old wiki-markup based user macros are now overdue some TLC. Luckily, there’s always the “Insert Wiki Markup” dropdown in the Confluence editor to fall back on.

To convert your macro…

  1. Create a new page and use the “Insert Wiki Markup” function to add your wiki markup:
    {section}
      {column}
        $body
      {column}
      {column:width=300px}
        {panel}
          *Contents:*
          {toc:maxLevel=3}
        {panel}
      {column}
    {section}
    
  2. Save the page
  3. From the Tools menu, select View Storage Format. This will give you:
    <ac:macro ac:name="section">
        <ac:rich-text-body>
            <ac:macro ac:name="column">
                <ac:rich-text-body>
                    <p>$body</p>
                </ac:rich-text-body>
            </ac:macro>
            <ac:macro ac:name="column">
                <ac:parameter ac:name="width">300px</ac:parameter>
                <ac:rich-text-body>
                    <ac:macro ac:name="panel">
                        <ac:rich-text-body>
                            <p><strong>Contents:</strong></p>
                            <ac:macro ac:name="toc">
                                <ac:parameter ac:name="maxLevel">3</ac:parameter>
                            </ac:macro>
                        </ac:rich-text-body>
                    </ac:macro>
                </ac:rich-text-body>
            </ac:macro>
        </ac:rich-text-body>
    </ac:macro>
    
  4. Paste this into your user macro rather than the old-fangled wiki markup.
  5. Repeat this procedure for all user macros you wish to convert.

David is a senior developer and consultant at AppFusions based in Nottingham, England.

AppFusions solves mixed-technology integration problems. We bring engineering and business workflows together, so you can work better, faster and smoother.

AppFusions is headquartered in San Francisco, California and works with enterprise vendors and partners such as IBM, Jive, Box, Atlassian and SugarCRM.

Twitter LinkedIn YouTube 

5 comments on ‘On converting wiki markup based user macros for use with Confluence 4’

  1. [...] David Simpson – On converting wiki markup based user macros for … David Simpson – On converting wiki markup based user macros for … Thomas Email Hansen recently wrote How do I write a user macro with “sections” and “panels” using the 4.0 HTML template?. With Confluence 4, the storage format has changed from traditional wiki markup to an XML based … Read Full Updates On This Blog [...]

  2. Mary-Jane Smyth says:

    Thank you for this helpful tip!

  3. [...] to the information on this page for this great tip. This entry was posted in macros. Bookmark the permalink. ← Change [...]

  4. Konstantin says:

    Is it possible to use this new xml macro syntax in server-side velocity templates, in a macro-module of some plugin. Like using the function VelocityUtils.getRenderedTemplate(template, context);? If yes, could you, please tell me how? (When I simply write xml macro code in velocity template it just passes that xml to the page without rendering of the macro.)

Leave a Reply