Why do I get a "Not an inline" macro error?

Last modified by Vincent Massol on 2013/05/21

When you save content you have entered in a page, XWiki will use its Rendering engine to transform that content into XHTML so that you browser can display it nicely to you. If you've used a Macro then the engine will evaluate it and replace it with the content generated by the Macro itself.

Now the Macro can generate content that be inserted into a paragraph or it can generate content that needs to be located on its own. For example in HTML if you use a header tag element (e.g. <h1>) then it needs to be located by itself on a new line. We call those elements Block elements (a.k.a Standalone elements in XWiki parlance). By contrast elements that can be inserted inside content without requiring to be located on a new line by themselves are called Inline elements.

Thus when you get "Not an inline" macro error it means the macro generates Block level elements and thus the macro needs to be by itself on a new line.

In addition in XWiki Syntax 2.0+ an element is a on new line separated from the rest only if there are 2 newline characters (a.k.a line breaks) that separates it from the content before and after it.

Examples of wrong usages of a standalone macro

Only one new line separating it from the previous and next content:

paragraph1
{{container}}
...
{{/container
paragraph2

Only one new line separating it from the next content:

paragraph1

{{container}}
...
{{/container
paragraph2

Only one new line separating it from the next content:

paragraph1
{{container}}
...
{{/container

paragraph2

Example of valid usage of a standalone macro

paragraph1

{{container}}
...
{{/container

paragraph2
Tags:
Created by Vincent Massol on 2013/05/21
   

Get Connected