mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Don't break Markdown from external sources (#5713)
This commit is contained in:
parent
79d1a2f458
commit
c3832d56c3
@ -103,6 +103,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
${this.localize("ui.panel.page-authorize.abort_intro")}:
|
${this.localize("ui.panel.page-authorize.abort_intro")}:
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
allowsvg
|
allowsvg
|
||||||
|
breaks
|
||||||
.content=${this.localize(
|
.content=${this.localize(
|
||||||
`ui.panel.page-authorize.form.providers.${step.handler[0]}.abort.${step.reason}`
|
`ui.panel.page-authorize.form.providers.${step.handler[0]}.abort.${step.reason}`
|
||||||
)}
|
)}
|
||||||
@ -113,6 +114,7 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
|
|||||||
${this._computeStepDescription(step)
|
${this._computeStepDescription(step)
|
||||||
? html`
|
? html`
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
|
breaks
|
||||||
.content=${this._computeStepDescription(step)}
|
.content=${this._computeStepDescription(step)}
|
||||||
></ha-markdown>
|
></ha-markdown>
|
||||||
`
|
`
|
||||||
|
@ -12,6 +12,8 @@ class HaMarkdown extends UpdatingElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public allowSvg = false;
|
@property({ type: Boolean }) public allowSvg = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public breaks = false;
|
||||||
|
|
||||||
protected update(changedProps) {
|
protected update(changedProps) {
|
||||||
super.update(changedProps);
|
super.update(changedProps);
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ class HaMarkdown extends UpdatingElement {
|
|||||||
this.innerHTML = await worker.renderMarkdown(
|
this.innerHTML = await worker.renderMarkdown(
|
||||||
this.content,
|
this.content,
|
||||||
{
|
{
|
||||||
breaks: true,
|
breaks: this.breaks,
|
||||||
gfm: true,
|
gfm: true,
|
||||||
tables: true,
|
tables: true,
|
||||||
},
|
},
|
||||||
|
@ -59,7 +59,9 @@ export const showConfigFlowDialog = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
return description
|
return description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown allowsvg breaks .content=${description}></ha-markdown>
|
||||||
|
`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -78,7 +80,9 @@ export const showConfigFlowDialog = (
|
|||||||
step.description_placeholders
|
step.description_placeholders
|
||||||
);
|
);
|
||||||
return description
|
return description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown allowsvg breaks .content=${description}></ha-markdown>
|
||||||
|
`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -112,7 +116,13 @@ export const showConfigFlowDialog = (
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
${description
|
${description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown
|
||||||
|
allowsvg
|
||||||
|
breaks
|
||||||
|
.content=${description}
|
||||||
|
></ha-markdown>
|
||||||
|
`
|
||||||
: ""}
|
: ""}
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
@ -128,7 +138,13 @@ export const showConfigFlowDialog = (
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
${description
|
${description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown
|
||||||
|
allowsvg
|
||||||
|
breaks
|
||||||
|
.content=${description}
|
||||||
|
></ha-markdown>
|
||||||
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<p>
|
<p>
|
||||||
${hass.localize(
|
${hass.localize(
|
||||||
|
@ -50,7 +50,13 @@ export const showOptionsFlowDialog = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
return description
|
return description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown
|
||||||
|
breaks
|
||||||
|
allowsvg
|
||||||
|
.content=${description}
|
||||||
|
></ha-markdown>
|
||||||
|
`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -69,7 +75,13 @@ export const showOptionsFlowDialog = (
|
|||||||
step.description_placeholders
|
step.description_placeholders
|
||||||
);
|
);
|
||||||
return description
|
return description
|
||||||
? html` <ha-markdown allowsvg .content=${description}></ha-markdown> `
|
? html`
|
||||||
|
<ha-markdown
|
||||||
|
allowsvg
|
||||||
|
breaks
|
||||||
|
.content=${description}
|
||||||
|
></ha-markdown>
|
||||||
|
`
|
||||||
: "";
|
: "";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class MoreInfoConfigurator extends PolymerElement {
|
|||||||
<div class="layout vertical">
|
<div class="layout vertical">
|
||||||
<template is="dom-if" if="[[isConfigurable]]">
|
<template is="dom-if" if="[[isConfigurable]]">
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
|
breaks
|
||||||
content="[[stateObj.attributes.description]]"
|
content="[[stateObj.attributes.description]]"
|
||||||
></ha-markdown>
|
></ha-markdown>
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ export class HuiPersistentNotificationItem extends LitElement {
|
|||||||
${this.notification.title}
|
${this.notification.title}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<ha-markdown content="${this.notification.message}"></ha-markdown>
|
<ha-markdown
|
||||||
|
breaks
|
||||||
|
content="${this.notification.message}"
|
||||||
|
></ha-markdown>
|
||||||
|
|
||||||
<div class="time">
|
<div class="time">
|
||||||
<span>
|
<span>
|
||||||
|
@ -81,6 +81,7 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard {
|
|||||||
return html`
|
return html`
|
||||||
<ha-card .header="${this._config.title}">
|
<ha-card .header="${this._config.title}">
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
|
breaks
|
||||||
class="markdown ${classMap({
|
class="markdown ${classMap({
|
||||||
"no-header": !this._config.title,
|
"no-header": !this._config.title,
|
||||||
})}"
|
})}"
|
||||||
|
@ -77,6 +77,7 @@ class HaMfaModuleSetupFlow extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
|||||||
<template is="dom-if" if="[[_equals(_step.type, 'abort')]]">
|
<template is="dom-if" if="[[_equals(_step.type, 'abort')]]">
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
allowsvg
|
allowsvg
|
||||||
|
breaks
|
||||||
content="[[_computeStepAbortedReason(localize, _step)]]"
|
content="[[_computeStepAbortedReason(localize, _step)]]"
|
||||||
></ha-markdown>
|
></ha-markdown>
|
||||||
</template>
|
</template>
|
||||||
@ -95,6 +96,7 @@ class HaMfaModuleSetupFlow extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
|||||||
>
|
>
|
||||||
<ha-markdown
|
<ha-markdown
|
||||||
allowsvg
|
allowsvg
|
||||||
|
breaks
|
||||||
content="[[_computeStepDescription(localize, _step)]]"
|
content="[[_computeStepDescription(localize, _step)]]"
|
||||||
></ha-markdown>
|
></ha-markdown>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user