mdorigin 0.7.2 → 0.7.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.
- package/dist/index-builder.js +15 -1
- package/package.json +1 -1
package/dist/index-builder.js
CHANGED
|
@@ -141,7 +141,8 @@ export async function buildManagedIndexBlock(directoryPath, plugins = [], exclud
|
|
|
141
141
|
kind: 'article',
|
|
142
142
|
title: entry.title,
|
|
143
143
|
href: entry.link,
|
|
144
|
-
detail: [entry.date, entry.summary].filter(Boolean).join(' · ') ||
|
|
144
|
+
detail: [formatIndexEntryDate(entry.date), entry.summary].filter(Boolean).join(' · ') ||
|
|
145
|
+
undefined,
|
|
145
146
|
})),
|
|
146
147
|
], plugins, {
|
|
147
148
|
mode: 'build',
|
|
@@ -166,6 +167,19 @@ export function upsertManagedIndexBlock(source, block, options = {}) {
|
|
|
166
167
|
}
|
|
167
168
|
return `${trimmed}\n\n${block}\n`;
|
|
168
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Managed index lines are human-facing. Date-only values keep their authored
|
|
172
|
+
* spelling, while normalized UTC timestamps render as `YYYY-MM-DD HH:mm`
|
|
173
|
+
* instead of raw ISO. Sorting still compares the normalized meta.date values.
|
|
174
|
+
*/
|
|
175
|
+
function formatIndexEntryDate(value) {
|
|
176
|
+
if (!value)
|
|
177
|
+
return undefined;
|
|
178
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
179
|
+
return value;
|
|
180
|
+
const match = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(value);
|
|
181
|
+
return match ? `${match[1]} ${match[2]}` : value;
|
|
182
|
+
}
|
|
169
183
|
function renderManagedIndexBlock(entries) {
|
|
170
184
|
const lines = [INDEX_START_MARKER, ''];
|
|
171
185
|
if (entries.length > 0) {
|