Stand with Ukraine 🇺🇦
Products
Services
Blog
About Us

Rendering, Printing, and Exporting Macro

Macros in Confluence Cloud behave differently depending on the rendering context. This behavior ensures macros are displayed or hidden based on the use case, offering flexibility in how content is consumed and exported.

Key Details:

  • Anonymous View: Macros are not rendered for users who are not logged in.

  • Exporting: Out-of-the-box exports include PDF and Word formats, while third-party apps handle all other export types as a default behavior.

  • Email Rendering: Macros can also render in email notifications sent by Confluence.

  • View and Edit Modes: Macros are rendered appropriately in both view and edit modes.

Example Use Cases:

  1. Internal Notes
    Add text that is visible only to internal users and not included in public-facing exports.
    NoPrint macro example:

    #if ( !$renderMode )
      🔐Sensitive information that should not be exported!
    #end
  2. External Notes
    Example from OnlyPrint user macro:

    #if ( $renderMode )
      👉Follow us on LinkedIn: https://linkedin.com/company/wombats-corp
    #end
  3. Original Link on Export
    Show a page link only in exported documents (e.g., PDF or Word).
    But not on emails and 3rd-party apps.

    #if($renderMode.equals("pdf") || $renderMode.equals("word"))
      "Exported from ${baseUrl}${page._links.webui}"
    #end
  4. Render output mode in context
    Distinguish display and edit mode in user macro

    #set ($mode = $renderContext.outputType)
    
    #if ($mode == "preview")
      This is edit mode
    #elseif($mode == "display")
      This is display mode
    #end

A good example of such usage is obsolete macro that should be deleted. Do not show it on the display mode and show warning to the editor: Macro to be deleted