@x-wave/blog 2.7.2 → 2.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/cli/index.js CHANGED
@@ -43,7 +43,10 @@ function parseArgs(argv) {
43
43
 
44
44
  /**
45
45
  * Parse YAML frontmatter from MDX content.
46
- * Supports string, boolean, and array values.
46
+ * Supports string (with optional double quotes), boolean, and array values.
47
+ *
48
+ * NOTE: This mirrors the canonical `parseFrontmatter` in the `types` package.
49
+ * Kept as a local copy because this CLI runs as plain .mjs without a build step.
47
50
  */
48
51
  function parseFrontmatter(content) {
49
52
  const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/)
@@ -67,7 +70,7 @@ function parseFrontmatter(content) {
67
70
  }
68
71
 
69
72
  // If we were in array context and hit a non-array line, save the array
70
- if (isArrayContext && !trimmed.startsWith('-')) {
73
+ if (isArrayContext) {
71
74
  frontmatter[currentKey] = arrayValues.slice()
72
75
  arrayValues.length = 0
73
76
  isArrayContext = false
@@ -80,7 +83,7 @@ function parseFrontmatter(content) {
80
83
  const value = trimmed.substring(colonIndex + 1).trim()
81
84
  currentKey = key
82
85
 
83
- // Empty value (nothing after the colon) means an array follows on subsequent lines
86
+ // Empty value means an array follows on subsequent lines
84
87
  if (value === '') {
85
88
  isArrayContext = true
86
89
  continue
@@ -88,7 +91,7 @@ function parseFrontmatter(content) {
88
91
 
89
92
  if (value === 'true') frontmatter[currentKey] = true
90
93
  else if (value === 'false') frontmatter[currentKey] = false
91
- else frontmatter[currentKey] = value
94
+ else frontmatter[currentKey] = value.replace(/^"(.*)"$/, '$1')
92
95
  }
93
96
  }
94
97