mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Allow for lists inside GitHub alerts when redered in markdown (#19505)
* Allow for lists inside GitHub alerts when redered in markdown * simplify
This commit is contained in:
parent
5c72c38c0d
commit
28a8863f45
@ -80,6 +80,9 @@ const CONFIGS = [
|
|||||||
> [!CAUTION]
|
> [!CAUTION]
|
||||||
> This is a GitHub caution alert
|
> This is a GitHub caution alert
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> - This is a list entry in GitHub tip alert
|
||||||
|
|
||||||
## Lists
|
## Lists
|
||||||
|
|
||||||
Unordered
|
Unordered
|
||||||
|
@ -98,13 +98,16 @@ class HaMarkdownElement extends ReactiveElement {
|
|||||||
firstElementChild!.childNodes[1].textContent?.trimStart()) ||
|
firstElementChild!.childNodes[1].textContent?.trimStart()) ||
|
||||||
"";
|
"";
|
||||||
|
|
||||||
const childNodes = Array.from(firstElementChild!.childNodes);
|
const childNodes = Array.from(node.childNodes)
|
||||||
for (const child of childNodes.slice(
|
.map((child) => Array.from(child.childNodes))
|
||||||
childNodes.findIndex(
|
.reduce((acc, val) => acc.concat(val), [])
|
||||||
// There is always a line break between the title and the content, we want to skip that
|
.filter(
|
||||||
(childNode) => childNode instanceof HTMLBRElement
|
(childNode) =>
|
||||||
) + 1
|
childNode.textContent &&
|
||||||
)) {
|
!(childNode.textContent in _gitHubBlockQuoteToAlert) &&
|
||||||
|
!(childNode.textContent in _legacyGitHubBlockQuoteToAlert)
|
||||||
|
);
|
||||||
|
for (const child of childNodes) {
|
||||||
alertNote.appendChild(child);
|
alertNote.appendChild(child);
|
||||||
}
|
}
|
||||||
node.firstElementChild!.replaceWith(alertNote);
|
node.firstElementChild!.replaceWith(alertNote);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user