How do I create a Markdown Card showing Temperatures for Entities with °F Unit Of Measurement?

I would like to have a table with entities and temperatures.
My problem is that I don’t know the markdown card well enough to achieve the result.

I can create the Markdown String using Developer Tools > Template

|Entity Name|°F|
|-|-|
{%- for state in states.sensor | selectattr('attributes.unit_of_measurement', '==', '°F') | rejectattr('state', 'in', ['unavailable', 'unknown']) %}
| {{- state.name }} | {{ state.state | int }} {{ state_attr(state.entity_id, 'unit_of_measurement') }} |
{%- endfor %}

which generates a markdown table that when previewed in Markdown looks like this
image

But I can not figure out how to have a markdown card display the result

I was only able to create a list of entities with temperatures, but I can only show the ‘name’ or the ‘state’ but not both

type: markdown
content: |-
  {% 
    set entities_with_temperature = states.sensor
      | selectattr('attributes.unit_of_measurement', 'defined')
      | rejectattr('state', 'in', ['unavailable', 'unknown'])
      | selectattr('attributes.unit_of_measurement', '==', '°F') 
      | map(attribute='name')
    %}
  - {{ entities_with_temperature | join('\n - ') }}
title: Entities with Temperatures

which resulted in this:
image

But I did that by reading other examples… and not fully understanding.

How do I create a Markdown Card showing Temperatures for Entities with °F Unit Of Measurement?

This works for me. Copy-paste it directly into the Markdown Card’s form in visual mode.

|Entity Name|°F|
|:---|:---:|
{%- for s in states.sensor
| selectattr('attributes.unit_of_measurement', 'defined')
| selectattr('attributes.unit_of_measurement', '==', '°F')
| rejectattr('state', 'in', ['unavailable', 'unknown']) %}
| {{ s.name }} | {{ s.state | int }} °F |
{%- endfor %}

FWIW, I shortened the template just a little bit (it didn’t have anything to do with displaying the table correctly). I removed this:

{{ state_attr(state.entity_id, 'unit_of_measurement') }} 

because the only possible value of unit_of_measurement is °F because of this:

selectattr('attributes.unit_of_measurement', '==', '°F')