This is an issue with Confluence. To avoid this, you have to use html output. If the body or your macro contain wiki markup, then you will have to render this by hand. My workaround is as follows:
## Use this macro to avoid new lines:
#macro(doNothing)#end
##
## (Do stuff with body in wiki format, if appropriate)
##
## Convert to html and remove paragraph tags:
#set($renderedhtml = "")
#if ($body && ($body.length()>0))
#set($globalHelper = $action.getHelper())
#set($renderedhtml = $globalHelper.renderConfluenceMacro("$body").replaceAll("</?[pP]>",""))
#end
##
## (Do stuff with body in html format, if appropriate)
##
## Output text:
$renderedhtml#doNothing()
EDIT: You will want to modify the regex if there are p tags in your macro that you want to keep. The regex in the code above will remove ALL p tags.
</p>
before and<p>
after my macro, embedding the preceding and the following text into new paragraphs. Can I cancel also these tags? – Cassiodorus