@voicenter-team/nuxt-llms-generator 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -615,7 +615,9 @@ function excludeChildrenFromContent(content) {
615
615
  return cleanContent;
616
616
  }
617
617
  function generatePageId(urlItem) {
618
- return `${urlItem.TemplateAlias}_${urlItem.nodeID}`;
618
+ const templateAlias = urlItem.TemplateAlias || "UnknownTemplate";
619
+ const nodeID = urlItem.nodeID || "UnknownNode";
620
+ return `${templateAlias}_${nodeID}`;
619
621
  }
620
622
  function estimateContentTokens(content) {
621
623
  try {
@@ -1323,6 +1325,7 @@ class TemplateGenerator {
1323
1325
  class LLMSFilesGenerator {
1324
1326
  config;
1325
1327
  templateGenerator;
1328
+ nhm = new NodeHtmlMarkdown();
1326
1329
  constructor(config) {
1327
1330
  this.config = config;
1328
1331
  this.templateGenerator = new TemplateGenerator(config);
@@ -1439,7 +1442,6 @@ class LLMSFilesGenerator {
1439
1442
 
1440
1443
  `;
1441
1444
  }
1442
- content += "This document contains all website content in a single file for comprehensive AI analysis.\n\n";
1443
1445
  content += "---\n\n";
1444
1446
  for (const mdFile of mdFiles) {
1445
1447
  const urlItem = umbracoData.urlList.find((item) => item.url === mdFile.url);
@@ -1516,11 +1518,22 @@ class LLMSFilesGenerator {
1516
1518
  }
1517
1519
  extractSiteTitle(umbracoData) {
1518
1520
  const siteData = umbracoData.SiteData;
1519
- return siteData?.pageTitle || siteData?.mainHeaderBlockTitle || "Website Documentation";
1521
+ const rawTitle = siteData?.pageTitle || siteData?.mainHeaderBlockTitle || "Website Documentation";
1522
+ return this.cleanHtmlContent(rawTitle);
1520
1523
  }
1521
1524
  extractSiteDescription(umbracoData) {
1522
1525
  const siteData = umbracoData.SiteData;
1523
- return siteData?.pageDescription || siteData?.ogDescription || null;
1526
+ const rawDescription = siteData?.pageDescription || siteData?.ogDescription || null;
1527
+ return rawDescription ? this.cleanHtmlContent(rawDescription) : null;
1528
+ }
1529
+ cleanHtmlContent(content) {
1530
+ if (!this.config.enableHtmlToMarkdown) {
1531
+ return content;
1532
+ }
1533
+ if (/<[^>]+>/.test(content)) {
1534
+ return this.nhm.translate(content).trim();
1535
+ }
1536
+ return content;
1524
1537
  }
1525
1538
  extractPageTitle(umbracoData, urlItem) {
1526
1539
  if (!urlItem)
@@ -1553,7 +1566,14 @@ class LLMSFilesGenerator {
1553
1566
  return names[category] || category.charAt(0).toUpperCase() + category.slice(1);
1554
1567
  }
1555
1568
  sanitizeUrlForFilename(url) {
1556
- return url.replace(/^\//, "").replace(/\/$/, "").replace(/\//g, "-").replace(/[^a-zA-Z0-9\-_]/g, "").replace(/^$/, "index");
1569
+ let filename = url.replace(/^\//, "").replace(/\/$/, "").replace(/\//g, "-").replace(/[^a-zA-Z0-9\-_.]/g, "").replace(/--+/g, "-").replace(/^-+|-+$/g, "");
1570
+ if (!filename || filename === "") {
1571
+ filename = "index";
1572
+ }
1573
+ if (filename.startsWith("-") || filename.startsWith(".")) {
1574
+ filename = "page-" + filename.replace(/^[-.]/, "");
1575
+ }
1576
+ return filename;
1557
1577
  }
1558
1578
  getRelativeFilePath(fullPath) {
1559
1579
  const filename = fullPath.split("/").pop() || "";
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.1.2"
7
+ "version": "0.1.3"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicenter-team/nuxt-llms-generator",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Nuxt 3 module for automatically generating AI-optimized documentation files (llms.txt, llms-full.txt, and individual .md files) from Umbraco CMS data using Anthropic's Claude API.",
5
5
  "repository": "your-org/my-module",
6
6
  "license": "MIT",