markdown-magic 3.6.5 → 4.0.0

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.
@@ -50,7 +50,7 @@ nice
50
50
  nice={{ value: nice, cool: "true" }}
51
51
  soclose=[jdjdjd, hdhfhfhffh]
52
52
  rad="boss"
53
- cool=true notCool=false
53
+ cool=true notCool=false
54
54
  nooooo={[one, two, 3, 4]}
55
55
  numberZero=0,
56
56
  xyz=999,
@@ -72,7 +72,7 @@ actual content
72
72
  <!-- XYZ:START(cool) xxx
73
73
  hhddh=cool -->
74
74
  wowow
75
- whatever we want 
75
+ whatever we want
76
76
  <!-- XYZ:END -->
77
77
 
78
78
 
@@ -135,7 +135,7 @@ test('Remove Markdown comments', () => {
135
135
  '',
136
136
  '',
137
137
  'wowow',
138
- 'whatever we want ',
138
+ 'whatever we want ',
139
139
  '',
140
140
  '',
141
141
  'xyz',
@@ -297,6 +297,79 @@ test('Convert comment syntax', () => {
297
297
  // assert.equal(typeof parsedValue, 'string')
298
298
  })
299
299
 
300
+ test('Remove TOML comments', () => {
301
+ const parsedValue = stripComments(`
302
+ # This is a TOML comment
303
+ title = "TOML Example"
304
+ # Another comment
305
+ [owner]
306
+ name = "Tom Preston-Werner"
307
+ # Inline comment
308
+ organization = "GitHub" # This is an inline comment
309
+ # Multi-line comment
310
+ # that continues
311
+ # on multiple lines
312
+ created = 1979-05-27T07:32:00Z
313
+
314
+ [database]
315
+ server = "192.168.1.1"
316
+ ports = [ 8001, 8001, 8002 ]
317
+ connection_max = 5000
318
+ enabled = true
319
+ `, 'toml')
320
+
321
+ assert.equal(typeof parsedValue, 'string')
322
+ assert.equal(parsedValue.match(/#/), null)
323
+ assert.equal(parsedValue.split('\n'), [
324
+ '',
325
+ 'title = "TOML Example"',
326
+ '[owner]',
327
+ 'name = "Tom Preston-Werner"',
328
+ 'organization = "GitHub"',
329
+ 'created = 1979-05-27T07:32:00Z',
330
+ '',
331
+ '[database]',
332
+ 'server = "192.168.1.1"',
333
+ 'ports = [ 8001, 8001, 8002 ]',
334
+ 'connection_max = 5000',
335
+ 'enabled = true',
336
+ ''
337
+ ])
338
+ })
339
+
340
+ test('Remove SQL comments', () => {
341
+ const parsedValue = stripComments(`
342
+ -- This is a single line comment
343
+ SELECT * FROM users
344
+ -- Another single line comment
345
+ WHERE id = 1
346
+ /* This is a multi-line
347
+ comment that spans
348
+ multiple lines */
349
+
350
+ AND active = true
351
+ SELECT name -- inline comment
352
+ FROM products
353
+ WHERE price > 100 /* another inline comment */
354
+ `, 'sql')
355
+
356
+ console.log('parsedValue', parsedValue)
357
+ assert.equal(typeof parsedValue, 'string')
358
+ assert.equal(parsedValue.match(/--/), null, 'SQL comments should be removed 1')
359
+ assert.equal(parsedValue.match(/\/\*/), null, 'SQL comments should be removed 2')
360
+ assert.equal(parsedValue.match(/\*\//), null, 'SQL comments should be removed 3')
361
+ assert.equal(parsedValue.split('\n'), [
362
+ '',
363
+ 'SELECT * FROM users',
364
+ 'WHERE id = 1',
365
+ '',
366
+ 'AND active = true',
367
+ 'SELECT name',
368
+ 'FROM products',
369
+ 'WHERE price > 100',
370
+ ''
371
+ ])
372
+ })
300
373
 
301
374
  function logOutput(value) {
302
375
  console.log(value.split('\n'))