INNER CODE UNIT · JavaScript
fmDescMatch
rockbenben/ChatGPT-Shortcut · plugin-gen-geo.js:205
const fmDescMatch = content.match(/^description:\s*(.*)$/m);
let summary;
if (fmDescMatch) {
summary = fmDescMatch[1].replace(/^['"]|['"]$/g, "").trim();
} else {
const contentBody = content.replace(/^---[\s\S]*?---/, "");
const cleaned = stripMarkdown(contentBody);
summary = smartTruncate(cleaned, 200) + (cleaned.length > 200 ? "..." : "");
}
docsList.push({ title, url, summary });
});
// 按相对路径排序,保证 llms.txt 输出顺序稳定
docsList.sort((a, b) => a.url.localeCompare(b.url));
// 4. Scan Prompts (src/data/prompt_{locale}.json)
let promptsPath = path.resolve(context.siteDir, `src/data/prompt_${currentLocale}.json`);