I wrote a small macro for spoilers. The only thing missing is that the spoiler content can’t have new lines. It’s plain text in the end. Wiki syntax is working.
I guess it’s a question of the parameter type. Currently I don’t have any type configured. It should look like a textarea.
You should use {{wikimacrocontent/}} and {{wikimacroparameter name="title" /}} to display the content/title. This ensures that the content is rendered correctly and that it is not vulnerable to XWiki syntax injection and XSS (see our security guide on how to escape content). You could take the expand macro as an example, this should fulfil your requirements I think.
Maybe you didn’t configure the macro content type properly (i.e., as WIKI)?
Regarding the title, I think there is a bug in the wiki macro renderer that doesn’t remove the wrapping paragraph when then parameter doesn’t support XWiki syntax. It might better when you specify the parameter type as WIKI, but I’m also not sure if the “inline” detection works in that mix of HTML and XWiki syntax. If you don’t want to support formatting, you could also just use the same code as the expand macro, i.e., $services.rendering.escape($escapetool.xml("${wikimacro.parameters.title}"), 'xwiki/2.1').
I just run into issues solving this same problem. I had issues with the wikimacroparameter macro with the wiki type.
Instead of inline styling I used the XWiki.StyleSheetExtension. I supported leaving the details open or not on initial access. That is, an “Open” boolean parameter, as well as a “Summary”. Then the content of the macro was the content of the details element itself.