Markdown-mod - Improve the built-in markdown card

But that is supported …

For now that’s actually possible by using the secret style property. Or you could install card-mod while will continue to officially support it.

Don’t understand why you’d say that? I use this:

      - type: markdown
        content: >
          Vandaag is het **<font color=green>[[ sensor.vandaag.state ]]</font>**.

          Volgende afval-ophaal over **<font color=var(--secondary-text-color)>[[ sensor.trash_next.state ]]</font>** dagen:

          **<font color=var(--secondary-text-color)>[[ sensor.trash_firstdate.state ]]</font>** : **[[ sensor.trash_firstwastetype.state ]]**

to get the above colorization, and works fine?

Hey Marius, that works for me too. Thanks for providing the example. I believe Thomas is indicating there is an undocumented “style:” property that is part of this mod that can be used somehow, similar to how his card-mod module did this.

Right you are, of course. Thank you!

1 Like

Hi all,

Is it possible to add a few blank spaces after an inserted icon ?
It seems all spaces are deleted before rendering ?

      - type: markdown
        style: |
          ha-card {
            background: [[color]];
            border-radius: 12px;
            font-size: 13px;
            font-family: Helvetica;
          }
        content: |
          <ha-icon icon="mdi:text"></ha-icon> My text should start a few spaces to the right of the icon

&nbsp; should work

Will try. Thanks for the quick help, Thomas !

For everyone’s reference, this is how it works:

<code>&nbsp;</code>

The code tags aren’t necessary.

content: |
  An icon in the <ha-icon icon="mdi:format-align-middle"></ha-icon> &nbsp;&nbsp;&nbsp;&nbsp; of the text.

Thanks for the clarification.

I’m trying to use markdown-mod but can’t read the entity’s state.
i installed the plugin with hacs utility and include them in ui-lovelace.yaml.

Cattura

can you help me?
Thanks.

[[ binary_sensor.random_binary_sensor ]]
Should work.

Great thanks.

I don’t know if you noticed the difference but I’m pretty sure you need a space after [[ and before ]] for it to work. Like you do in your last line which worked.

Is there any way to specify a size for the icon?

<ha-icon ... style="width: 48px; height: 48px;"></ha-icon>

Thank you very much!

please let me get back on my markdown card using the binary_sensor.meteoalarm_brabant.

If this sensor is ‘on’, it produces the attributes I show with this config:

  - type: markdown
    content: >
      # <font color= grey> Weer Alarm Brabant:  [[ binary_sensor.meteoalarm_brabant.state ]] </font>

      ___

      **Alarm code**

      <font color= [[ sensor.weer_alarm.state ]]> - [[ sensor.weer_alarm.state ]] </font>

      <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_level ]] </font>

      <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_type ]] </font>

      **Headline**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.headline ]] </font>

      **Event**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.event ]] </font>

      **Status**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.description ]] </font>

      ___

however, when there is no alarm, the binary_sensor is ‘off’ and none of its attributes is created, so the card looks silly.

So, my question would be if we could have conditional text via the markdown mod.

otherwise Id need something like this:

  - type: custom:vertical-stack-in-card
    cards:
      - type: entities
        title: Weeralarm
        show_header_toggle: false
        entities:
          - binary_sensor.meteoalarm_brabant
          - sensor.weer_alarm
      - type: markdown
        content: >
          <font color= grey> Info:  [[ binary_sensor.meteoalarm_brabant.attributes.attribution ]] </font>
      - type: conditional
        conditions:
          - entity: binary_sensor.meteoalarm_brabant
            state: 'on'
        card:
          type: markdown
          content: >
            # <font color= grey> Weer Alarm Brabant:  [[ binary_sensor.meteoalarm_brabant.state ]] </font>

            ___

            **Alarm code**

            <font color= [[ sensor.weer_alarm.state ]]> - [[ sensor.weer_alarm.state ]] </font>

            <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_level ]] </font>

            <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_type ]] </font>

            **Headline**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.headline ]] </font>

            **Event**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.event ]] </font>

            **Status**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.description ]] </font>

            ___

30
which is ok of course, but needs yet again another card…
thanks for having a look!

(If you read my post before the edit, forget it, I made a mistake in the card and used an - in front of the conditional card…)

Yes.

Pro tip: Don’t grow too attached to markdown-mod…