Is it possible for plugin macros to return wiki markup as user macros do? I have tried outputting wiki markup but it just renders as plain text.
If the output of your macro is intended for display in a browser (as most are) then it is required to output HTML.
I guess you are asking if you, as the developer can write wiki markup and have it converted to HTML. This is possible but may well be an unnecessary over-head. Is this wiki content dynamic? If not you are much better to just write your HTML output directly.
Anyway, if you do want to convert wiki to XHTML then you will need to inject a com.atlassian.renderer.WikiStyleRenderer to your macro. e.g.
public void setWikiStyleRenderer(WikiStyleRenderer wikiStyleRenderer) { this.wikiStyleRenderer = wikiStyleRenderer; }
You can then convert your wiki with something like -
return getWikiStyleRenderer().convertWikiToXHtml(new PageContext(), wiki);
You are right - I do the wiki markup to be output as HTML in a browser. I was intending to use existing macros for formatting, to save replicating the HTML they use. It most certainly will be using dynamic content. I will re-assess my needs - you may be right in that it may be unecessary overhead.
What is the 'wiki' variable passed as the second argument to convertWikiToXHtml()? Is that a string containing the wiki markup?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried setting the render mode to RenderMode.NO_RENDER?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you mean using:
public RenderMode getBodyRenderMode() {
return RenderMode.NO_RENDER;
}
then yes, I have. This does not work, and if I understand the documentation correctly, it describes how the body of the macro - the code between the start and end tags - is to be processed, not the final output of the macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.