mnfst 0.5.28 → 0.5.29

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.
@@ -1324,6 +1324,20 @@ function setNestedValue(obj, path, value) {
1324
1324
  current[keys[keys.length - 1]] = value;
1325
1325
  }
1326
1326
 
1327
+ // If the key-value result has only numeric top-level keys (e.g. 0.path, 1.path), convert to array
1328
+ // so $route/$search/$query work and the shape matches YAML/JSON array sources.
1329
+ function numericKeyObjectToArray(obj) {
1330
+ if (obj == null || Array.isArray(obj) || typeof obj !== 'object') {
1331
+ return obj;
1332
+ }
1333
+ const keys = Object.keys(obj);
1334
+ if (keys.length === 0) return obj;
1335
+ const numericKeys = keys.filter(k => /^\d+$/.test(k));
1336
+ if (numericKeys.length !== keys.length) return obj;
1337
+ const sorted = numericKeys.map(k => parseInt(k, 10)).sort((a, b) => a - b);
1338
+ return sorted.map(i => obj[String(i)]);
1339
+ }
1340
+
1327
1341
  // Parse CSV text to nested object structure
1328
1342
  function parseCSVToNestedObject(csvText, options = {}) {
1329
1343
  const {
@@ -1427,7 +1441,7 @@ function parseCSVToNestedObject(csvText, options = {}) {
1427
1441
  setNestedValue(result, key, value);
1428
1442
  }
1429
1443
 
1430
- return result;
1444
+ return numericKeyObjectToArray(result);
1431
1445
  }
1432
1446
  } else {
1433
1447
  // Fallback simple parser (if PapaParse not loaded)
@@ -1539,7 +1553,7 @@ function parseCSVToNestedObject(csvText, options = {}) {
1539
1553
  setNestedValue(result, key, value);
1540
1554
  }
1541
1555
 
1542
- return result;
1556
+ return numericKeyObjectToArray(result);
1543
1557
  }
1544
1558
  }
1545
1559
  }
@@ -506,15 +506,16 @@ async function initializeMarkdownPlugin() {
506
506
  }
507
507
  lastProcessedContent = markdownContent;
508
508
 
509
- // Skip empty content
510
- if (!markdownContent || markdownContent.trim() === '') {
509
+ // Ensure we have a string (e.g. $route('path')?.content can be a proxy while loading)
510
+ const contentStr = typeof markdownContent === 'string' ? markdownContent : '';
511
+ if (!contentStr || contentStr.trim() === '') {
511
512
  el.style.opacity = '0';
512
513
  hasContent = false;
513
514
  return;
514
515
  }
515
516
 
516
517
  const marked = await loadMarkedJS();
517
- let html = marked.parse(markdownContent);
518
+ let html = marked.parse(contentStr);
518
519
 
519
520
  // Post-process HTML to enable checkboxes (remove disabled attribute)
520
521
  html = enableCheckboxes(html);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.28",
3
+ "version": "0.5.29",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter"