forbid inline use of the display macro (and others) - this might break backwards compatibility, especially if the macro is used in scripts where the macro is indented for better readability
let the macro renderer smell that it is user in edit mode and an inline context, and then do not display its contents (but maybe a notice why it's content is not displayed, though I am not sure how well this works in line mode).
I prefer the second solution. Having a big bunch of content displayed which is not editable anyway seems not to be user friendly anyway, IMHO.
Then this does not fix the issue that the public view will display invalid HTML. (From a browser point of view this might not batter much, they sure have seen worse ...)
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.