Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-05-01 15:20:27 -07:00
parent ab89d98128
commit a392f138e9
2 changed files with 256 additions and 540 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -17,9 +17,45 @@ const formatAsList = (array) => {
};
file.write('# Vendors\n\n');
file.write('## Table of Contents by Category\n\n');
const categoriesMap = new Map();
for (const vendor of vendors) {
const category = (vendor.category || vendor.categories || 'Uncategorized');
if (!categoriesMap.has(category)) {
categoriesMap.set(category, []);
}
categoriesMap.get(category).push(vendor.name);
}
const sortedCategories = [...categoriesMap.keys()].sort();
for (const category of sortedCategories) {
file.write(`### ${category}\n\n`);
const vendorsInCategory = categoriesMap.get(category).sort();
for (const vendorName of vendorsInCategory) {
// Create proper anchor by:
// 1. Converting to lowercase
// 2. Replacing spaces with hyphens
// 3. Removing parentheses, dots, and other special characters
const anchor = vendorName.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[\(\)\.]/g, '')
.replace(/[^a-z0-9\-]/g, '');
file.write(`- [${vendorName}](#${anchor})\n`);
}
file.write('\n');
}
file.write('---\n\n');
for (const vendor of vendors) {
// Vendor name and description
file.write(`## ${vendor.name}\n\n`);
if (vendor.description) {
file.write(`${vendor.description}\n\n`);