Markdown-mod - Improve the built-in markdown card

Thanks for the link Thomas.
I already have see the docs, but i’m unfortunately not tech enough to find the answer myself :slight_smile:
Could you please point out the how to do it.
Thanks again.

Know what? 0.98 has been released. That means this card is now deprecated! :tada:

The default markdown card in 0.98 and later supports jinja templates, so now you can do:

type: markdown
content: |
  {% if is_state('sensor.number_of_lights_on', '0') %}
    All lights are off
  {% else %}
    {{ states('sensor.number_of_lights_on') }} lights are on.
  {% endif %}

No plugins required!

4 Likes

DEPRECATED

All functions of this plugin are now included (and improved) in Home Assistant 0.98 or later

Note that templates is jinja2 instead of my stupid ones.
https://www.home-assistant.io/lovelace/markdown/#content
https://www.home-assistant.io/docs/configuration/templating/

Templating in a native Lovelace card? Isn’t that a departure from what was the stated position?
Does that mean other cards might get templating?

It is, but an awesome enough way to implement it was found that minds were changed. Home Assistant is a living project defined by its users, and lovelace adapts to how people use them.

With no small amount of hubris, one might compare to how the iPhone originally had no third party apps by design…

I can’t see that any other cards would get templating at this point. But 0.98 also lets custom cards use jinja templating in a fast and convenient way… (https://github.com/thomasloven/lovelace-card-mod/releases/tag/4)

Let’s indeed voice our wish that Lovelace adopts native Jinja, and that templating will become available throughout the HA instance, and be consistent in its implementation… version 1.0 should be ready for native Jinja :wink:

It is a major step taken now, let’s all support that, kudos to the dev’s that have made this possible! (thanks Thomas…)

Are you talking about your custom card only, or is this available for all card now?

  - type: markdown
    content: >
      **Weersverwachting:** <font color= {% if states('sensor.dark_sky_temperature')|float >= 30 %} #f00
      {% else %} #008000 {% endif %} >
      {{ states('sensor.dark_sky_daily_summary')}} </font> 

:+1:

I’m not seeing any reference to an upgrade for the Markdown Card in the 0.98 Blog. It’s long so maybe I just missed it.

After upgrading to 0.98, I removed the URL in resources in ui-lovelace.yaml & cleared cache. My card no longer renders the sensors values. Is there another change I need to make?

          - type: markdown
            style: |
              ha-card {
                height: 231px
              }
            padding: '0px'
            content: >
              ## [[ sensor.floorplan_date.state ]][[ sensor.suffix_day.state ]]

              [[ sensor.next_payday.state ]]

              [[ sensor.next_holiday.state ]]

              [[ sensor.next_birthday.state ]]


              [[ sensor.next_fullmoon.state ]]

              [[ sensor.next_dst.state ]]

              [[ sensor.next_season.state ]]

              [[ sensor.next_game ]]

  

have a look at my post above yours, and see how can use regular Jinja now.

Thank you both, it sure helps when I put my contacts in!

I hope you don’t think I was complaining?
Far from it!

Oh no. Not at all. I’m just saying don’t assume truths will be true forever.

Thanks a lot :slight_smile:

thanks for all your efforts making this mod available @thomasloven!

I’ll begin the process of converting to long term support jinja

Can you still access the current user and browser values in the new approach? i.e. what was {user} ?

No, but I’m working on a way to make card-mod force support for that…

Didn’t really think anyone was actually using it…

1 Like

HI,

trying to set some properties for my cards background, I see exactly nothing at all changing…

with the new native HA markdown card, what do we still need to do so? I style: now accepted natively, or do we still need a -mod card.

I tried to do this:

  - type: markdown
    style: |
      ha-card {
      background-color: lightgrey
      border-radius: 6px
      }
etc

or:

  - type: markdown
    style: |
      ha-card {
      background-color: 'rgba(250, 250, 250, 1)';
      border-radius: 6px;
      }

I uninstalled markdown-mod, but still have card-mod in place.
thanks for having a look.

–update–

got this to work:

  - type: markdown
    style: |
      ha-card {
      --ha-card-background: lightgrey;
      border-radius: 6px;
      }

though the markdown card isn’t mentioned among the cards needing that special attention in theFAQ

is this correct, and the way we need to format the style? Or I something missing in my config.

The first snippet doesn’t work because css requires semicolons at the end of the lines.
The second snippet doesn’t work because 'rgba(250, 250, 250, 1)' isn’t a valid css value (rgba(250, 250, 250, 1) is, though)

Regarding the third snippet; what does this have to do with the other question of the faq?

exactly nothing. I am really sorry, was confused and for a moment thought I was using the custom:hui-<type>-card: construction.

thanks for the other corrections. Ive got it working now. much appreciated.!

1 Like

I know that this plugin is deprecated since 0.99 but i hope you guys could help me. I used “{user}” to show username but today no longer works. What is the new syntax?