diff --git a/frontend/routes/package/(_islands)/DependencyGraph.tsx b/frontend/routes/package/(_islands)/DependencyGraph.tsx index 02fc1f67..cdc56373 100644 --- a/frontend/routes/package/(_islands)/DependencyGraph.tsx +++ b/frontend/routes/package/(_islands)/DependencyGraph.tsx @@ -236,7 +236,7 @@ function renderDependency( content = `${tooltip}\n${ dependency.entrypoints.map((entrypoint) => { if (entrypoint == ".") { - return "default entrypoint"; + return "default entrypoint"; } else { return entrypoint; } @@ -262,11 +262,22 @@ function renderDependency( break; } + const renderAttributeValue = (content?: string) => { + if (!content) return content; + + const hasHTMLTag = /(.+?)<\/i>/.test(content); + if (hasHTMLTag) { + const htmlContent = content.replace(/\n/g, "
"); + return `<${htmlContent}>`; + } + return `"${content}"`; + }; + return `[${ Object .entries({ href, tooltip, label: content, color }) .filter(([_, v]) => v) - .map(([k, v]) => `${k}="${v}"`) + .map(([k, v]) => `${k}=${renderAttributeValue(v)}`) .join(", ") }]`; }