Templating not working in markdown card used as pop-up with browser-mod

I’m trying to make a popup card that displays weather alert data. I can create a markdown card and use templates to add the information I want, however when I use the same configuration as a popup, it just displays the template code, instead of the data.

Here’s the configuration that works as a plain markdown card.

type: markdown
content: >-
  <b>What:</b> {{
  state_attr('sensor.natrona_county_lower_elevations','alerts')[0].NWSheadline
  }}

  <b>Area:</b> {{
  state_attr('sensor.natrona_county_lower_elevations','alerts')[0].area }}

  <b>Certainty:</b> {{
  state_attr('sensor.natrona_county_lower_elevations','alerts')[0].certainty }}

  <b>Expires:</b> {{
  state_attr('sensor.natrona_county_lower_elevations','alerts')[0].expires }}
title: Weather Alert

Which produces this card:
markdown_card

The code I use to make it a popup:

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: browser_mod.popup
  target: {}
  data:
    type: markdown
    content: >
      <b>What:</b> {{
      state_attr('sensor.natrona_county_lower_elevations','alerts')[0].NWSheadline
      }}

      <b>Area:</b> {{
      state_attr('sensor.natrona_county_lower_elevations','alerts')[0].area }}

      <b>Certainty:</b> {{
      state_attr('sensor.natrona_county_lower_elevations','alerts')[0].certainty
      }}

      <b>Expires:</b> {{
      state_attr('sensor.natrona_county_lower_elevations','alerts')[0].expires
      }}
    deviceID:
      - this
    title: Alert Detail
    dismissable: true
    autoclose: false
entity: sensor.natrona_county_lower_elevations

The card pops up, but the templates are not interpreted and just printed as plain text.
Is there some reason templates don’t work in a pop-up? Am I missing something?

Thanks in advance.

Still haven’t figured out how to get the templating working in a pop-up, but I did figure out a work-around, in case this could help someone else.
My original goal was to have a conditional button that would only appear when there were active weather alerts, then it would show me details of the alert in a pop-up when clicked.
My work-around is to have a hidden view in the dashboard, so when I click on the weather alert button it navigates to the hidden view that has markdown cards displaying the details of the active alerts. I added a “back button” on the hidden view to navigate back to my main view. It actually works quite well, but I wish I could figure out why the pop-ups aren’t working.

You have to pass the markdown card options in the content property, instead of defining type: markdown as an option for the browser_mod.popup service:

tap_action:
  action: call-service
  service: browser_mod.popup
  data:
    content:
      type: markdown
      content: >
        <b>What:</b> {{
         state_attr('sensor.natrona_county_lower_elevations','alerts')[0].NWSheadline
        }}