Fix Mermaid diagrams failing when node labels contain line breaks (#37296)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Nicolas
2026-04-19 17:39:40 +02:00
committed by GitHub
parent 2f5b5a9e9c
commit 284298f2a9
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -265,7 +265,7 @@ export function isElemVisible(el: HTMLElement): boolean {
return Boolean(!el.classList.contains('tw-hidden') && (el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none');
}
export function createElementFromHTML<T extends HTMLElement>(htmlString: string): T {
export function createElementFromHTML<T extends Element>(htmlString: string): T {
htmlString = htmlString.trim();
// There is no way to create some elements without a proper parent, jQuery's approach: https://github.com/jquery/jquery/blob/main/src/manipulation/wrapMap.js
// eslint-disable-next-line github/unescaped-html-literal