How to export custom field XML so that HTML can be rendered in Confluence's Jira filter macro

I have a custom field that renders as a link (calculated at runtime) in Jira and I want to include the results in Confluence’s “Jira filter” macro, but Confluence keeps stripping out the HTML elements.

I added the following line to the custom field’s definition in atlassian-plugin.xml:

<resource type="velocity" name="xml" location="templates/LinkXml.vm"/>

I populated LinkXml.vm to render the field as an HTML link (I.e. <a href=…>), but when the field renders in the Jira filter macro in Confluence it just shows as plaintext and not a link.

How do I get confluence to render it as HTML?

Thanks,
Andrew