mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(site): strip script and style tags from llms markdown output (#678)
This commit is contained in:
@@ -44,12 +44,16 @@ export default function llmsMarkdown(): AstroIntegration {
|
||||
continue;
|
||||
}
|
||||
|
||||
// For each content element, remove [data-llms-ignore] descendants
|
||||
// For each content element, strip non-content elements before conversion
|
||||
const contentParts: string[] = [];
|
||||
contentElements.forEach((contentEl) => {
|
||||
const clone = contentEl.cloneNode(true) as Element;
|
||||
const ignoreElements = clone.querySelectorAll('[data-llms-ignore]');
|
||||
ignoreElements.forEach((el) => el.remove());
|
||||
// Remove script and style tags (includes Astro island hydration scripts)
|
||||
for (const tag of clone.querySelectorAll('script, style')) {
|
||||
tag.remove();
|
||||
}
|
||||
contentParts.push(clone.innerHTML);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user