Mozilla Support uses a well-designed wiki for its Knowledge Base. The KB uses a "macro" they call For. Here's how they explain it.
One of the great features of our Knowledge Base is the ability to show instructions customized for operating systems (Windows, Android, etc.) and Firefox versions. We can say, for example, that a certain section of a help article is "for" Windows users and Mac and Linux users won't see it. The feature is designed to work invisibly. When someone opens a help article, we'll automatically detect what operating system and version of Firefox they are using and show the appropriate instructions.
Is there a Confluence plugin that performs a similar function? I've done some searching, but haven't found anything. If there isn't something that exists, any ideas on how complicated making a macro like this would be?