@mono-labs/cli 0.0.209 → 0.0.211
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.
|
@@ -46,13 +46,24 @@ async function generateDocsIndex({ docsDir, excludeFile, }) {
|
|
|
46
46
|
const match = contents.match(/^#\s+(.+)$/m);
|
|
47
47
|
if (!match)
|
|
48
48
|
continue;
|
|
49
|
-
const
|
|
49
|
+
const rawTitle = match[1].trim();
|
|
50
50
|
const relativeLink = `./${entry.name}`;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Detect leading non-alphanumeric characters (emoji / symbols).
|
|
53
|
+
* This matches one or more Unicode characters that are NOT letters or numbers.
|
|
54
|
+
*/
|
|
55
|
+
const leadingSymbolMatch = rawTitle.match(/^([^\p{L}\p{N}]+)\s*(.+)$/u);
|
|
56
|
+
if (leadingSymbolMatch) {
|
|
57
|
+
const [, symbol, title] = leadingSymbolMatch;
|
|
58
|
+
links.push(`- ${symbol.trim()} [${title.trim()}](${relativeLink})`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
links.push(`- [${rawTitle.trim()}](${relativeLink})`);
|
|
62
|
+
}
|
|
52
63
|
}
|
|
53
|
-
// Sort alphabetically by
|
|
64
|
+
// Sort alphabetically by rendered text (stable output)
|
|
54
65
|
links.sort((a, b) => a.localeCompare(b));
|
|
55
|
-
// Append Back to Readme
|
|
66
|
+
// Append Back to Readme
|
|
56
67
|
links.push('');
|
|
57
68
|
links.push('🏠 ← [Back to README](../README.md)');
|
|
58
69
|
return links.join('\n');
|
package/package.json
CHANGED
|
@@ -53,18 +53,29 @@ export async function generateDocsIndex({
|
|
|
53
53
|
const match = contents.match(/^#\s+(.+)$/m);
|
|
54
54
|
if (!match) continue;
|
|
55
55
|
|
|
56
|
-
const
|
|
56
|
+
const rawTitle = match[1].trim();
|
|
57
57
|
const relativeLink = `./${entry.name}`;
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Detect leading non-alphanumeric characters (emoji / symbols).
|
|
61
|
+
* This matches one or more Unicode characters that are NOT letters or numbers.
|
|
62
|
+
*/
|
|
63
|
+
const leadingSymbolMatch = rawTitle.match(/^([^\p{L}\p{N}]+)\s*(.+)$/u);
|
|
64
|
+
|
|
65
|
+
if (leadingSymbolMatch) {
|
|
66
|
+
const [, symbol, title] = leadingSymbolMatch;
|
|
67
|
+
links.push(`- ${symbol.trim()} [${title.trim()}](${relativeLink})`);
|
|
68
|
+
} else {
|
|
69
|
+
links.push(`- [${rawTitle.trim()}](${relativeLink})`);
|
|
70
|
+
}
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
// Sort alphabetically by
|
|
73
|
+
// Sort alphabetically by rendered text (stable output)
|
|
63
74
|
links.sort((a, b) => a.localeCompare(b));
|
|
64
75
|
|
|
65
|
-
// Append Back to Readme
|
|
76
|
+
// Append Back to Readme
|
|
66
77
|
links.push('');
|
|
67
|
-
|
|
68
78
|
links.push('🏠 ← [Back to README](../README.md)');
|
|
79
|
+
|
|
69
80
|
return links.join('\n');
|
|
70
81
|
}
|