You could attach an additional req.args['narrow'] to formatter.req on
macro execution time, that should be available later on in req object
passed in filter_stream method. But I see, that using Request object is
or at least is planned to be depreciated according to the wiki docs [1].
So a more sustainable way leaving the req alone would be to add a
minimal, unique HTML snipped like
<div id="narrow_marker"></div>
and create a matching XPATH filter like
xpath_match = "//div[@id='narrow_marker']"
to
* find it (and possibly remove it)
* finally add the 'narrow' class to div#content
as you already know how to do by a secondary filter expression, that
should be triggered by the first one.
Sincerely,
Steffen Hoffmann
[1]
http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.wiki.api.IWikiMacroProvider#Usage