markdown-magic 4.5.5 → 4.5.8

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.js +17 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-magic",
3
- "version": "4.5.5",
3
+ "version": "4.5.8",
4
4
  "description": "Automatically update markdown files with content from external sources",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -43,8 +43,8 @@
43
43
  "@davidwells/md-utils": "0.0.53",
44
44
  "color-convert": "^2.0.1",
45
45
  "comment-block-parser": "1.5.4",
46
- "comment-block-replacer": "0.1.13",
47
- "comment-block-transformer": "0.5.5",
46
+ "comment-block-replacer": "0.1.15",
47
+ "comment-block-transformer": "0.5.7",
48
48
  "globrex": "^0.1.2",
49
49
  "gray-matter": "^4.0.3",
50
50
  "is-glob": "^4.0.3",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "3d60211919bdc910870a92270b64a7aeed5e44fc"
73
+ "gitHead": "2bef6eae03b732f55673524c1e928ecff8b2c86c"
74
74
  }
package/src/index.js CHANGED
@@ -176,13 +176,18 @@ async function markdownMagic(globOrOpts = {}, options = {}) {
176
176
  open = `${opts.matchWord}:start`
177
177
  }
178
178
 
179
- let close = CLOSE_WORD
180
- if (opts.close) {
179
+ // When open is custom and close not specified, leave close undefined
180
+ // to enable pattern mode in block-parser (auto-generates close as /OpenTag)
181
+ let close
182
+ if (opts.close !== undefined) {
181
183
  close = opts.close
182
184
  // @ts-ignore legacy
183
185
  } else if (opts.matchWord) {
184
186
  // @ts-ignore legacy
185
187
  close = `${opts.matchWord}:end`
188
+ } else if (!opts.open || opts.open === OPEN_WORD) {
189
+ // Only default to /docs when using default open word
190
+ close = CLOSE_WORD
186
191
  }
187
192
 
188
193
  const cwd = opts.cwd || process.cwd()
@@ -291,11 +296,16 @@ async function markdownMagic(globOrOpts = {}, options = {}) {
291
296
 
292
297
 
293
298
 
294
- const patterns = getBlockRegex({
295
- syntax,
296
- openText: open,
297
- closeText: close
298
- })
299
+ // Pattern mode (close undefined) - parseBlocks handles regex generation
300
+ // Standard mode - get patterns for comment stripping
301
+ let patterns = {}
302
+ if (close !== undefined) {
303
+ patterns = getBlockRegex({
304
+ syntax,
305
+ openText: open,
306
+ closeText: close
307
+ })
308
+ }
299
309
 
300
310
  if (debug) {
301
311
  console.log(`patterns:`, patterns)