Fill macro content with marked text from editor?




currently I’m formatting a lot of pages and I have to mark a lot of text as code. And to be honest this is quite tedious.
Is there any way to mark a piece of text in the editor and surround it by a macro/the code macro?
It would be nice if I could mark a text and have it copied to the macro content.

Thanks in advance.


I usually use the wiki editor for this (or switch to the “source” tab).


@ClemensRobbenhaar thanks for your answer. It’s not that there is a real problem, it’s just quite an inconvenience and an inconsistency in workflows.
Compare these two workflows (as they really occur to me, not the ideal world):

  1. “Bolden text”:
    • Type the text
    • mark it
    • press the bold button
    • done
  2. “Mark as code”:
    • Type the text,
    • mark it
    • press the macro button
    • select the Code macro
    • curse (:wink:)
    • cancel
    • copy the text
    • press the macro button
    • select the Code macro
    • paste the code/text
    • press submit
    • done

This very forum for example (I understand that the editor is more limited than the xwiki one) can be used with following only the “type, mark, format”-workflow.

I think it would be a great enhancement for the editor to have a more consistent workflow.


Well, my post was not really an answer. The answer would have been: “I do not know” :wink: It is just a workaround that works ok for me.


So I guess the expectation is that the macro content text area is prefilled with the selected text right? With this you’ll just have to press submit. And if you use you should be able to reduce the workflow to:

  • type the text
  • select it
  • click the dedicated macro button from the tool bar
  • press submit
  • done

The question is what should happen if you select rich text (formatted text, lists, tables, etc.). We could probably try to convert that to wiki syntax and paste it into the macro content text area, but it’s more complex.

In any any case, prefilling the macro content text area with the selected plain text is easy to do as a first step if that helps you. Can you report an improvement on ?


That would be a great step forward. I happily will create an improvement this evening.