mdat 1.3.4 → 1.3.5
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/dist/bin/cli.js +278 -0
- package/dist/lib/index.d.ts +156 -0
- package/dist/lib/index.js +7 -0
- package/package.json +46 -34
- package/readme.md +17 -14
- package/bin/cli.js +0 -29419
- package/dist/api.d.ts +0 -31
- package/dist/config.d.ts +0 -74
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -24796
- package/dist/mdat-json-loader.d.ts +0 -7
- package/dist/processors.d.ts +0 -12
- package/dist/readme/api.d.ts +0 -46
- package/dist/readme/config.d.ts +0 -14
- package/dist/readme/init.d.ts +0 -18
- package/dist/readme/rules/badges.d.ts +0 -7
- package/dist/readme/rules/banner.d.ts +0 -7
- package/dist/readme/rules/code.d.ts +0 -6
- package/dist/readme/rules/contributing.d.ts +0 -7
- package/dist/readme/rules/description.d.ts +0 -10
- package/dist/readme/rules/footer.d.ts +0 -10
- package/dist/readme/rules/header.d.ts +0 -11
- package/dist/readme/rules/index.d.ts +0 -66
- package/dist/readme/rules/license.d.ts +0 -7
- package/dist/readme/rules/short-description.d.ts +0 -12
- package/dist/readme/rules/size-table.d.ts +0 -6
- package/dist/readme/rules/size.d.ts +0 -6
- package/dist/readme/rules/table-of-contents.d.ts +0 -9
- package/dist/readme/rules/title.d.ts +0 -8
- package/dist/readme/rules/toc.d.ts +0 -11
- package/dist/readme/rules/utilities/size/size-report.d.ts +0 -19
- package/dist/readme/templates/index.d.ts +0 -27
- package/dist/readme/utilities.d.ts +0 -15
- package/dist/utilities.d.ts +0 -10
package/readme.md
CHANGED
|
@@ -98,7 +98,7 @@ In this case, according to a set of rules defined in an external configuration f
|
|
|
98
98
|
|
|
99
99
|
### Dependencies
|
|
100
100
|
|
|
101
|
-
The `mdat` CLI tool and API requires Node
|
|
101
|
+
The `mdat` CLI tool and API requires Node 20+ (specifically `>=20.19.0`). `mdat` is implemented in TypeScript and bundles a complete set of type definitions.
|
|
102
102
|
|
|
103
103
|
### Installation
|
|
104
104
|
|
|
@@ -278,7 +278,7 @@ mdat expand <files..> [options]
|
|
|
278
278
|
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
279
279
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
280
280
|
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
281
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
281
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
282
282
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
283
283
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
284
284
|
|
|
@@ -302,7 +302,7 @@ mdat check <files..> [options]
|
|
|
302
302
|
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
303
303
|
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
304
304
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
305
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
305
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
306
306
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
307
307
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
308
308
|
|
|
@@ -327,7 +327,7 @@ mdat collapse <files..> [options]
|
|
|
327
327
|
| `--name`<br>`-n` | Output file name. | `string` | Same name as input file. Overwrites the input file. |
|
|
328
328
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
329
329
|
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
330
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
330
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
331
331
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
332
332
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
333
333
|
|
|
@@ -379,7 +379,7 @@ mdat readme expand [files..] [options]
|
|
|
379
379
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
380
380
|
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
381
381
|
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
382
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
382
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
383
383
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
384
384
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
385
385
|
|
|
@@ -405,7 +405,7 @@ mdat readme check [files..] [options]
|
|
|
405
405
|
| `--assets` | Path to find and save readme-related assets. | `string` | `./assets` |
|
|
406
406
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
407
407
|
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
408
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
408
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
409
409
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
410
410
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
411
411
|
|
|
@@ -430,7 +430,7 @@ mdat readme collapse [files..] [options]
|
|
|
430
430
|
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
431
431
|
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
432
432
|
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
433
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
433
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
434
434
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
435
435
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
436
436
|
|
|
@@ -452,7 +452,7 @@ mdat readme init [options]
|
|
|
452
452
|
| `--expand`<br>`-e` | Automatically run `mdat readme` immediately after creating the readme template. | `boolean` | `true` |
|
|
453
453
|
| `--template`<br>`-t` | Specify a template to use for the new readme. | `"MDAT Readme"` `"Standard Readme Basic"` `"Standard Readme Full"` | `"MDAT Readme"` |
|
|
454
454
|
| `--compound`<br>`-c` | Use compound comment version of the template to replace several individual comment placeholders where possible. This combines things like `<!-- title -->`, `<!-- badges -->`, etc. in a single `<!-- header -->` comment. It's less clutter when you're editing, but it's also less explicit. The final readme.md output is identical. | `boolean` | `true` |
|
|
455
|
-
| `--verbose` | Enable verbose logging. All verbose logs
|
|
455
|
+
| `--verbose` | Enable verbose logging. All verbose logs are prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
456
456
|
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
457
457
|
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
458
458
|
|
|
@@ -483,13 +483,13 @@ mdat *.md
|
|
|
483
483
|
A number of option flags are exposed on the CLI. Any values set here will override both ambient configuration files and any configuration file referenced passed as options:
|
|
484
484
|
|
|
485
485
|
```sh
|
|
486
|
-
mdat
|
|
486
|
+
mdat --prefix 'mm-'
|
|
487
487
|
```
|
|
488
488
|
|
|
489
489
|
##### Custom configuration file
|
|
490
490
|
|
|
491
491
|
```sh
|
|
492
|
-
mdat
|
|
492
|
+
mdat --config 'custom-config.ts'
|
|
493
493
|
```
|
|
494
494
|
|
|
495
495
|
##### Rule sets
|
|
@@ -540,7 +540,7 @@ Highlights include:
|
|
|
540
540
|
function expandString(markdown: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile>
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
Takes a string of Markdown and returns
|
|
543
|
+
Takes a string of Markdown and returns a [VFile](https://github.com/vfile), which includes both the post-conversion Markdown content and additional metadata about the conversion.
|
|
544
544
|
|
|
545
545
|
To get the Markdown content, simply call `.toString()` on the returned VFile object.
|
|
546
546
|
|
|
@@ -650,7 +650,7 @@ type Config = {
|
|
|
650
650
|
|
|
651
651
|
A valid configuration file default-exports an object conforming to the above type.
|
|
652
652
|
|
|
653
|
-
The configuration file may be located in any location supported by [
|
|
653
|
+
The configuration file may be located in any location supported by [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#searchplaces). I use an `mdat.config.ts` file in the root of my projects.
|
|
654
654
|
|
|
655
655
|
> [!NOTE]
|
|
656
656
|
>
|
|
@@ -687,7 +687,7 @@ Some notes on the type:
|
|
|
687
687
|
|
|
688
688
|
Since it's a record, multiple rules may be combined in single rules file.
|
|
689
689
|
|
|
690
|
-
If multiple configuration and rule files are loaded, they are merged. CLI options take precedence over ambient configuration discovered by
|
|
690
|
+
If multiple configuration and rule files are loaded, they are merged. CLI options take precedence over ambient configuration discovered by cosmiconfig, and where multiple configuration or rule files are provided, the "last" rule of a particular key takes precedence.
|
|
691
691
|
|
|
692
692
|
### Creating custom rules
|
|
693
693
|
|
|
@@ -749,7 +749,7 @@ See the [Examples section](https://github.com/kitschpatrol/remark-mdat#examples)
|
|
|
749
749
|
|
|
750
750
|
| File | Original | Gzip | Brotli |
|
|
751
751
|
| ------------ | -------- | ------- | ------ |
|
|
752
|
-
| package.json | 2.
|
|
752
|
+
| package.json | 2.7 kB | 1.1 kB | 1 kB |
|
|
753
753
|
| readme.md | 64 kB | 11.6 kB | 9.3 kB |
|
|
754
754
|
|
|
755
755
|
<!-- /size-table -->
|
|
@@ -916,6 +916,9 @@ This has been done several times before:
|
|
|
916
916
|
|
|
917
917
|
- lillallol's [md-in-place](https://www.npmjs.com/package/md-in-place)
|
|
918
918
|
|
|
919
|
+
- [AutoMD](https://automd.unjs.io/)\
|
|
920
|
+
Extremely similar functionality to mdat, with the project initiated around the same time I was initially writing mdat. I didn't find the project until a few years later. Ships in the night.
|
|
921
|
+
|
|
919
922
|
### Implementation notes
|
|
920
923
|
|
|
921
924
|
This project was split from a monorepo containing both `mdat` and `remark-mdat` into separate repos in July 2024.
|