How do I prevent my rendered wiki text from being surrounded by paragraph tags?

How do I prevent my rendered wiki text from being surrounded by <p> tags?

When wiki text is converted to HTML, the level of conversion is determined by the RenderMode set within the RenderContext. Understanding RenderMode is quite important, so you should familiarise yourself with the documentation linked above.

There are two render modes that are useful if you want to avoid the output being placed inside paragraph tags:

RenderMode.INLINE will suppress the rendering of all block-level HTML elements, including paragraphs, blockquotes, tables and lists. Inline elements such as text decorations, links and images will still be rendered.

RenderMode.suppress( RenderMode.F_FIRST_PARA ) will render block-level elements as usual, but if the first such element is a paragraph, no paragraph tags will be drawn around it. This is useful if you're placing your output inside a <div>.

If you are writing a macro, you will also need to return true from your macro's isInline method.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport