Skip to content

Commit

Permalink
Markdown support
Browse files Browse the repository at this point in the history
**Really nice** with Markdown
  • Loading branch information
NewsguyTor committed Jan 28, 2025
1 parent f5a2dd6 commit 008d34c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 5 deletions.
5 changes: 2 additions & 3 deletions flower-card.js

Large diffs are not rendered by default.

Binary file modified flower-card.js.gz
Binary file not shown.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"custom-card-helpers": "^1.9.0",
"home-assistant-js-websocket": "^9.4.0",
"lit": "^3.2.0",
"marked": "^15.0.6",
"webpack": "^5.95.0",
"yarn": "^1.22.22"
},
Expand Down
2 changes: 1 addition & 1 deletion src/flower-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class FlowerCard extends LitElement {
if (this.stateObj.attributes.notes === null || this.stateObj.attributes.notes.trim() === '') {
return html`<div class="divider"></div><div class="notes notes-empty">Plant has no notes, add one in the device's configuration. Edit this card and uncheck "Notes" if you want to hide this.</div>`;
}
return html`<div class="divider"></div><div class="notes">${this.stateObj.attributes.notes}</div>`;
return html`<div class="divider"></div><div class="notes"><ha-markdown .content=${this.stateObj.attributes.notes} allow-svg></ha-markdown></div>`;
})()}
</ha-card>
`;
Expand Down
1 change: 0 additions & 1 deletion src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const style = css`
.notes {
padding: 15px;
color: var(--primary-text-color);
white-space: pre-wrap;
}
.notes-empty {
color: var(--secondary-text-color);
Expand Down
1 change: 1 addition & 0 deletions src/types/flower-card-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface FlowerCardConfig extends LovelaceCardConfig {
battery_sensor?: string;
display_type?: DisplayType;
show_info?: string[];
markdown?: string;
}

export enum DisplayType {
Expand Down

0 comments on commit 008d34c

Please # to comment.