markdown-magic 3.4.2 → 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.
- package/README.md +18 -16
- package/cli.js +1 -1
- package/package-lock.json +1127 -0
- package/package.json +12 -12
- package/src/.DS_Store +0 -0
- package/{lib → src}/block-parser.js +4 -0
- package/{lib → src}/cli.js +0 -0
- package/{lib → src}/index.js +1 -1
- package/{lib → src}/process-contents.js +28 -4
- package/{lib → src}/transforms/index.js +8 -6
- package/src/transforms/sectionToc.js +37 -0
- package/src/transforms/toc.js +107 -0
- package/src/utils/.DS_Store +0 -0
- package/src/utils/details.js +15 -0
- package/{lib → src}/utils/toc.js +33 -7
- package/lib/transforms/sectionToc.js +0 -18
- package/lib/transforms/toc.js +0 -31
- /package/{lib → src}/argparse/README.md +0 -0
- /package/{lib → src}/argparse/argparse.js +0 -0
- /package/{lib → src}/argparse/argparse.test.js +0 -0
- /package/{lib → src}/argparse/index.js +0 -0
- /package/{lib → src}/argparse/splitOutsideQuotes.js +0 -0
- /package/{lib → src}/argparse/splitOutsideQuotes.test.js +0 -0
- /package/{lib → src}/block-parser-js.test.js +0 -0
- /package/{lib → src}/block-parser.test.js +0 -0
- /package/{lib → src}/cli.test.js +0 -0
- /package/{lib → src}/defaults.js +0 -0
- /package/{lib → src}/globparse.js +0 -0
- /package/{lib → src}/globparse.test.js +0 -0
- /package/{lib → src}/index.test.js +0 -0
- /package/{lib → src}/process-file.js +0 -0
- /package/{lib → src}/transforms/code/index.js +0 -0
- /package/{lib → src}/transforms/code/resolve-github-file.js +0 -0
- /package/{lib → src}/transforms/code/resolve-github-file.test.js +0 -0
- /package/{lib → src}/transforms/file.js +0 -0
- /package/{lib → src}/transforms/remote.js +0 -0
- /package/{lib → src}/transforms/wordCount.js +0 -0
- /package/{lib → src}/types.js +0 -0
- /package/{lib → src}/utils/fs.js +0 -0
- /package/{lib → src}/utils/fs.test.js +0 -0
- /package/{lib → src}/utils/hash-file.js +0 -0
- /package/{lib → src}/utils/index.js +0 -0
- /package/{lib → src}/utils/load-config.js +0 -0
- /package/{lib → src}/utils/logs.js +0 -0
- /package/{lib → src}/utils/regex-timeout.js +0 -0
- /package/{lib → src}/utils/regex.js +0 -0
- /package/{lib → src}/utils/remoteRequest.js +0 -0
- /package/{lib → src}/utils/sortOrder.js +0 -0
- /package/{lib → src}/utils/string-break.js +0 -0
- /package/{lib → src}/utils/syntax.js +0 -0
- /package/{lib → src}/utils/text.js +0 -0
- /package/{lib → src}/utils/text.test.js +0 -0
- /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
|
|
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('../
|
|
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="./
|
|
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="./
|
|
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
|
|
270
|
-
- `collapseText` - *string* - (optional): Text the toc
|
|
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 `
|
|
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 `
|
|
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 `
|
|
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 `
|
|
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('../
|
|
418
|
-
const { deepLog } = require('../
|
|
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
|