Mixing markdown and html in a shortcode

I have a shortcode that looks like

{{ "<fieldset><legend>" | safeHTML }}

@string definitions

{{ "</legend>" | safeHTML }}

#### Expand the @string vars below during imports

When enabled, BBT will prepend the @strings section below to all Bib(La)TeX imports and will expand the strings during export.

#### If a field could be a @string var, export it without braces

When enabled, BBT will try to retain @string vars its exports unsurrounded by braces; when set to 'detect', single-word strings will be assumed to be externally-defined @string vars,
when set to 'match', only @strings declared in the @strings section of the preferences will be preserved. If you don't know what this means, leave it off.

Options:

* No
* Assume single-word fields to be @string vars
* Match against the @string vars below

{{ "</fieldset>" | safeHTML }}

but that treats the markdown inside the fieldset as if it were HTML already. I know everything inside HTML tags is supposed to be HTML, but is there a way to mix HTML and MD this way?