How to add user macro into a plugin

koushikkothagal September 23, 2019

I have a user macro created in the Confluence Admin UI. How do I add it to a Confluence plugin?

I tried creating a macro using the Confluence tutorial, but the tutorial shows how to return a String as HTML. I even tried rendering my user macro .vm file in the plugin using Velocity helpers, but I don't seem to have the same context (no $content for example).

 

Please help!

1 answer

1 accepted

0 votes
Answer accepted
koushikkothagal September 23, 2019

Solved the problem using the context passed into the execute method:

public String execute(Map<String, String> parameters, String body, ConversionContext context) throws MacroExecutionException {

PageContext pageContext = context.getPageContext();
contextMap.put("content", pageContext.getEntity());

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events