markdown-magic 3.4.1 → 3.5.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.
Files changed (54) hide show
  1. package/README.md +18 -16
  2. package/cli.js +1 -1
  3. package/package-lock.json +1127 -0
  4. package/package.json +14 -12
  5. package/src/.DS_Store +0 -0
  6. package/{lib → src}/block-parser.js +4 -0
  7. package/{lib → src}/cli.js +0 -0
  8. package/{lib → src}/index.js +4 -1
  9. package/{lib → src}/process-contents.js +28 -4
  10. package/src/transforms/file.js +75 -0
  11. package/{lib → src}/transforms/index.js +8 -6
  12. package/src/transforms/sectionToc.js +37 -0
  13. package/src/transforms/toc.js +107 -0
  14. package/src/utils/.DS_Store +0 -0
  15. package/src/utils/details.js +15 -0
  16. package/{lib → src}/utils/toc.js +33 -7
  17. package/lib/transforms/file.js +0 -42
  18. package/lib/transforms/sectionToc.js +0 -18
  19. package/lib/transforms/toc.js +0 -31
  20. /package/{lib → src}/argparse/README.md +0 -0
  21. /package/{lib → src}/argparse/argparse.js +0 -0
  22. /package/{lib → src}/argparse/argparse.test.js +0 -0
  23. /package/{lib → src}/argparse/index.js +0 -0
  24. /package/{lib → src}/argparse/splitOutsideQuotes.js +0 -0
  25. /package/{lib → src}/argparse/splitOutsideQuotes.test.js +0 -0
  26. /package/{lib → src}/block-parser-js.test.js +0 -0
  27. /package/{lib → src}/block-parser.test.js +0 -0
  28. /package/{lib → src}/cli.test.js +0 -0
  29. /package/{lib → src}/defaults.js +0 -0
  30. /package/{lib → src}/globparse.js +0 -0
  31. /package/{lib → src}/globparse.test.js +0 -0
  32. /package/{lib → src}/index.test.js +0 -0
  33. /package/{lib → src}/process-file.js +0 -0
  34. /package/{lib → src}/transforms/code/index.js +0 -0
  35. /package/{lib → src}/transforms/code/resolve-github-file.js +0 -0
  36. /package/{lib → src}/transforms/code/resolve-github-file.test.js +0 -0
  37. /package/{lib → src}/transforms/remote.js +0 -0
  38. /package/{lib → src}/transforms/wordCount.js +0 -0
  39. /package/{lib → src}/types.js +0 -0
  40. /package/{lib → src}/utils/fs.js +0 -0
  41. /package/{lib → src}/utils/fs.test.js +0 -0
  42. /package/{lib → src}/utils/hash-file.js +0 -0
  43. /package/{lib → src}/utils/index.js +0 -0
  44. /package/{lib → src}/utils/load-config.js +0 -0
  45. /package/{lib → src}/utils/logs.js +0 -0
  46. /package/{lib → src}/utils/regex-timeout.js +0 -0
  47. /package/{lib → src}/utils/regex.js +0 -0
  48. /package/{lib → src}/utils/remoteRequest.js +0 -0
  49. /package/{lib → src}/utils/sortOrder.js +0 -0
  50. /package/{lib → src}/utils/string-break.js +0 -0
  51. /package/{lib → src}/utils/syntax.js +0 -0
  52. /package/{lib → src}/utils/text.js +0 -0
  53. /package/{lib → src}/utils/text.test.js +0 -0
  54. /package/{lib → src}/utils/toposort.js +0 -0
package/README.md CHANGED
@@ -19,7 +19,7 @@ This `README.md` is generated with `markdown-magic` [view the raw file](https://
19
19
  [Video demo](http://www.youtube.com/watch?v=4V2utrvxwJ8) • [Example Repo](https://github.com/DavidWells/repo-using-markdown-magic)
20
20
 
21
21
  ## Table of Contents
22
- <!-- ⛔️ MD-MAGIC-EXAMPLE:START TOC collapse=true collapseText="Click to expand" -->
22
+ <!-- ⛔️ MD-MAGIC-EXAMPLE:START TOC collapseText="Click to expand" -->
23
23
  <details>
24
24
  <summary>Click to expand</summary>
25
25
 
@@ -108,7 +108,7 @@ If you have a `markdown.config.js` file where `markdown-magic` is invoked, it wi
108
108
  ### Running programmatically
109
109
 
110
110
  ```js
111
- const { markdownMagic } = require('../lib')
111
+ const { markdownMagic } = require('../src')
112
112
 
113
113
  /* By default all .md files in cwd will be processed */
114
114
  markdownMagic().then((results) => {
@@ -185,7 +185,7 @@ content to be replaced
185
185
  ```
186
186
  <!-- ⛔️ MD-MAGIC-EXAMPLE:END *-->
187
187
 
188
- <!-- ⛔️ MD-MAGIC-EXAMPLE:START JSDocs path="./lib/index.js" -->
188
+ <!-- ⛔️ MD-MAGIC-EXAMPLE:START JSDocs path="./src/index.js" -->
189
189
  ### API
190
190
 
191
191
  Markdown Magic Instance
@@ -231,7 +231,9 @@ Below is the main config for `markdown-magic`
231
231
  | `dryRun` (optional) | `boolean` | See planned execution of matched blocks. Default: `false` |
232
232
  | `debug` (optional) | `boolean` | See debug details. Default: `false` |
233
233
  | `silent` (optional) | `boolean` | Silence all console output. Default: `false` |
234
+ | `applyTransformsToSource` (optional) | `boolean` | Apply transforms to source file. Default is true. Default: `true` |
234
235
  | `failOnMissingTransforms` (optional) | `boolean` | Fail if transform functions are missing. Default skip blocks. Default: `false` |
236
+ | `failOnMissingRemote` (optional) | `boolean` | Fail if remote file is missing. Default: `true` |
235
237
 
236
238
  #### `OutputConfig`
237
239
 
@@ -259,15 +261,15 @@ Result of markdown processing
259
261
 
260
262
  Markdown Magic comes with a couple of built-in transforms for you to use or you can extend it with your own transforms. See 'Custom Transforms' below.
261
263
 
262
- <!-- ⛔️ MD-MAGIC-EXAMPLE:START JSDocs path="./lib/transforms/index.js" -->
264
+ <!-- ⛔️ MD-MAGIC-EXAMPLE:START JSDocs path="./src/transforms/index.js" -->
263
265
  ### > TOC
264
266
 
265
267
  Generate table of contents from markdown file
266
268
 
267
269
  **Options:**
268
270
  - `firsth1` - *boolean* - (optional): Show first h1 of doc in table of contents. Default `false`
269
- - `collapse` - *boolean* - (optional): Collapse the table of contents in a detail accordian. Default `false`
270
- - `collapseText` - *string* - (optional): Text the toc accordian summary
271
+ - `collapse` - *boolean* - (optional): Collapse the table of contents in a detail accordion. Default `false`
272
+ - `collapseText` - *string* - (optional): Text the toc accordion summary
271
273
  - `excludeText` - *string* - (optional): Text to exclude in the table of contents. Default `Table of Contents`
272
274
  - `maxDepth` - *number* - (optional): Max depth of headings. Default 4
273
275
 
@@ -278,7 +280,7 @@ toc will be generated here
278
280
  <!-- end-doc-gen -->
279
281
  ```
280
282
 
281
- Default `MATCHWORD` is `AUTO-GENERATED-CONTENT`
283
+ Default `matchWord` is `doc-gen`
282
284
 
283
285
  ---
284
286
 
@@ -305,12 +307,12 @@ This content will be dynamically replaced with code from the file
305
307
  ```
306
308
 
307
309
  ```md
308
- <!-- doc-gen CODE src="./relative/path/to/code.js" lines=22-44 -->
309
- This content will be dynamically replaced with code from the file lines 22 through 44
310
- <!-- end-doc-gen -->
311
- ```
310
+ <!-- doc-gen CODE src="./relative/path/to/code.js" lines=22-44 -->
311
+ This content will be dynamically replaced with code from the file lines 22 through 44
312
+ <!-- end-doc-gen -->
313
+ ```
312
314
 
313
- Default `MATCHWORD` is `AUTO-GENERATED-CONTENT`
315
+ Default `matchWord` is `doc-gen`
314
316
 
315
317
  ---
316
318
 
@@ -333,7 +335,7 @@ This content will be dynamically replaced from the local file
333
335
  <!-- end-doc-gen -->
334
336
  ```
335
337
 
336
- Default `MATCHWORD` is `AUTO-GENERATED-CONTENT`
338
+ Default `matchWord` is `doc-gen`
337
339
 
338
340
  ---
339
341
 
@@ -356,7 +358,7 @@ This content will be dynamically replaced from the remote url
356
358
  <!-- end-doc-gen -->
357
359
  ```
358
360
 
359
- Default `MATCHWORD` is `AUTO-GENERATED-CONTENT`
361
+ Default `matchWord` is `doc-gen`
360
362
 
361
363
  ---
362
364
 
@@ -414,8 +416,8 @@ The below code is used to generate **this markdown file** via the plugin system.
414
416
  const path = require('path')
415
417
  const { readFileSync } = require('fs')
416
418
  const { parseComments } = require('doxxx')
417
- const { markdownMagic } = require('../lib')
418
- const { deepLog } = require('../lib/utils/logs')
419
+ const { markdownMagic } = require('../src')
420
+ const { deepLog } = require('../src/utils/logs')
419
421
 
420
422
  const config = {
421
423
  matchWord: 'MD-MAGIC-EXAMPLE', // default matchWord is AUTO-GENERATED-CONTENT
package/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const mri = require('mri')
3
- const { runCli } = require('./lib/cli')
3
+ const { runCli } = require('./src/cli')
4
4
  const argv = process.argv.slice(2)
5
5
  const cliArgs = mri(argv)
6
6