Understanding inline macro positioning

Dear Community,

I am new to XWiki and trying to understand how macro positioning works. I understand that there are standalone and inline macros. Obviously, macros can only be used inline when their output is suitable for it.

However, I am struggling to use very simple macros inline with other content when adding them to a document in the WYSIWYG editor.

Example:
I have a simple macro that uses the HTML macro to output a :

{{velocity}}
{{html}}
<span style="background-color: gold">Label</span>
{{/html}}
{{/velocity}}

Inline Support for the macro is enabled.

When I add the macro via UI in the WYSIWYG editor, it is placed in the document as a standalone macro. It fills the whole line, because the engine will add a <p> element when rendering the macro content. I couldn’t find a way to position the macro inline with some text.

Now, when I switch to XWiki editor, and just add some text next to the macro, it works just fine inline with the text. When switching back to WYSIWYG I can now handle the macro as inline, I can move it, type next to it and so on. The additional <p> is not inserted. It looks like the macro has “switched” its mode from standalone to inline.

I would like use the macro in inline mode immediately after inserting it in WYSIWYG editor. Is there some option to toggle between inline and standalone mode? I could not find any information about this, but I assume this must have a very simple solution and I am overlooking something here.

PS: I am using XWiki 17.4.1.

Just tested (on XWiki 17.5.0) and it worked well for me. I could type “Hello” and insert the macro just after.

1 Like

I see. Thank you for your answer. I was not familiar with this behavior as our previous wiki did not differentiate between standalone and inline macros depending on the position.

Just for clarification:

If you insert a macro on a blank new line in WYSIWYG, it will be inserted in standalone mode. You can “switch” it to inline mode by moving it to a line with content in XWiki editor. If you want it in inline mode directly, you have to insert it in a line that already has some content in it. You can switch it back to standalone by moving it to a blank line.

Yes, we currently don’t have a WYSIWYG action to force a macro to be inline when located on a line by itself (ie standalone).

1 Like

We discussed adding a way for a macro to indicate that it should always be inserted in inline mode in this proposal, but it hasn’t been implemented yet.

1 Like