Confluence Docs 3.0 : How do I convert wiki text to HTML? This page last changed on Oct 07, 2007 by smaddox. ### Cannot resolve external resource into attachment. How do I convert wiki text to HTML? This depends on where you want to do it: #### In a macro... You will need the SubRenderer (see how to retrieve it). The SubRenderer has two `render` methods: one that allows you to specify a specific RenderMode for the rendered content, and another that uses the current RenderMode from the RenderContext.
| If you just want the body of your macro rendered, you can have this done for you by the macro subsystem by having your macro's `getBodyRenderMode` method return the appropriate RenderMode.
#### In some other component... You will need the WikiStyleRenderer (see how to retrieve a component). The WikiStyleRenderer has a `convertWikiToHtml` method that takes the wiki text you wish to convert, and a RenderContext. If you are converting the text in the context of some ContentEntityObject (for example within a page or blog post), then you can call `contentEntityObject.toPageContext()` to retrieve its RenderContext. Otherwise pass in a `new PageContext()`.

Document generated by Confluence on Nov 05, 2009 23:34