mdat 1.2.3 → 1.3.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/bin/cli.js +21 -10
- package/dist/config.d.ts +7 -2
- package/dist/index.js +11 -7
- package/dist/readme/config.d.ts +3 -1
- package/package.json +6 -6
- package/readme.md +50 -50
package/bin/cli.js
CHANGED
|
@@ -4605,7 +4605,7 @@ var yargs_default = Yargs;
|
|
|
4605
4605
|
|
|
4606
4606
|
//#endregion
|
|
4607
4607
|
//#region package.json
|
|
4608
|
-
var version = "1.
|
|
4608
|
+
var version = "1.3.0";
|
|
4609
4609
|
|
|
4610
4610
|
//#endregion
|
|
4611
4611
|
//#region node_modules/.pnpm/irregular-plurals@4.2.0/node_modules/irregular-plurals/irregular-plurals.json
|
|
@@ -8440,7 +8440,6 @@ ZodNaN.create = (params) => {
|
|
|
8440
8440
|
...processCreateParams(params)
|
|
8441
8441
|
});
|
|
8442
8442
|
};
|
|
8443
|
-
const BRAND = Symbol("zod_brand");
|
|
8444
8443
|
var ZodBranded = class extends ZodType {
|
|
8445
8444
|
_parse(input) {
|
|
8446
8445
|
const { ctx } = this._processInputParams(input);
|
|
@@ -8765,12 +8764,12 @@ const configSchema = optionsSchema.merge(objectType({
|
|
|
8765
8764
|
/**
|
|
8766
8765
|
* Load and validate mdat configuration / rule sets
|
|
8767
8766
|
* Uses cosmiconfig to search in the usual places.
|
|
8768
|
-
* Merge precedence:
|
|
8767
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
8769
8768
|
*
|
|
8770
8769
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
8771
8770
|
*/
|
|
8772
8771
|
async function loadConfig(options) {
|
|
8773
|
-
const { additionalConfig, additionalRules, searchFrom } = options ?? {};
|
|
8772
|
+
const { additionalConfig, additionalRules, readmeDefaults, searchFrom } = options ?? {};
|
|
8774
8773
|
let finalConfig = {
|
|
8775
8774
|
addMetaComment: false,
|
|
8776
8775
|
assetsPath: "./assets",
|
|
@@ -8780,6 +8779,7 @@ async function loadConfig(options) {
|
|
|
8780
8779
|
packageFile: await findPackage(),
|
|
8781
8780
|
rules: { mdat: `Powered by the Markdown Autophagic Template system: [mdat](https://github.com/kitschpatrol/mdat).` }
|
|
8782
8781
|
};
|
|
8782
|
+
if (readmeDefaults) finalConfig = deepMergeDefined(finalConfig, readmeDefaults);
|
|
8783
8783
|
const configExplorer = cosmiconfig("mdat", { loaders: { ".ts": TypeScriptLoader() } });
|
|
8784
8784
|
const results = await configExplorer.search(searchFrom);
|
|
8785
8785
|
if (results) {
|
|
@@ -28747,16 +28747,19 @@ var rules_default = {
|
|
|
28747
28747
|
//#endregion
|
|
28748
28748
|
//#region src/lib/readme/config.ts
|
|
28749
28749
|
/**
|
|
28750
|
-
* Convenience loader to always include the default readme config
|
|
28750
|
+
* Convenience loader to always include the default readme config.
|
|
28751
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
28752
|
+
* but higher priority than base mdat defaults.
|
|
28751
28753
|
*/
|
|
28752
28754
|
async function loadConfigReadme(options) {
|
|
28753
28755
|
const defaultReadmeConfig = {
|
|
28754
28756
|
addMetaComment: true,
|
|
28755
28757
|
rules: rules_default
|
|
28756
28758
|
};
|
|
28757
|
-
const { additionalConfig = [],...rest } = options ?? {};
|
|
28759
|
+
const { additionalConfig = [], readmeDefaults = defaultReadmeConfig,...rest } = options ?? {};
|
|
28758
28760
|
const result = await loadConfig({
|
|
28759
|
-
additionalConfig:
|
|
28761
|
+
additionalConfig: Array.isArray(additionalConfig) ? additionalConfig : [additionalConfig],
|
|
28762
|
+
readmeDefaults,
|
|
28760
28763
|
...rest
|
|
28761
28764
|
});
|
|
28762
28765
|
if (result.packageFile === void 0) throw new Error("Package file path is required in `mdat readme` config");
|
|
@@ -28764,7 +28767,7 @@ async function loadConfigReadme(options) {
|
|
|
28764
28767
|
}
|
|
28765
28768
|
|
|
28766
28769
|
//#endregion
|
|
28767
|
-
//#region node_modules/.pnpm/yocto-queue@1.2.
|
|
28770
|
+
//#region node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
28768
28771
|
var Node = class {
|
|
28769
28772
|
value;
|
|
28770
28773
|
next;
|
|
@@ -28795,6 +28798,7 @@ var Queue = class {
|
|
|
28795
28798
|
if (!current) return;
|
|
28796
28799
|
this.#head = this.#head.next;
|
|
28797
28800
|
this.#size--;
|
|
28801
|
+
if (!this.#head) this.#tail = void 0;
|
|
28798
28802
|
return current.value;
|
|
28799
28803
|
}
|
|
28800
28804
|
peek() {
|
|
@@ -29186,8 +29190,15 @@ const configOption = { config: {
|
|
|
29186
29190
|
} };
|
|
29187
29191
|
const metaOption = { meta: {
|
|
29188
29192
|
alias: "m",
|
|
29189
|
-
|
|
29190
|
-
|
|
29193
|
+
coerce(value) {
|
|
29194
|
+
if (typeof value === "string") {
|
|
29195
|
+
if (value.toLowerCase() === "false" || value === "0") return false;
|
|
29196
|
+
if (value.toLowerCase() === "true" || value === "1") return true;
|
|
29197
|
+
return value;
|
|
29198
|
+
}
|
|
29199
|
+
return value;
|
|
29200
|
+
},
|
|
29201
|
+
description: "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."
|
|
29191
29202
|
} };
|
|
29192
29203
|
const nameOption = { name: {
|
|
29193
29204
|
alias: "n",
|
package/dist/config.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Config = Simplify<Options & {
|
|
|
6
6
|
packageFile?: string;
|
|
7
7
|
}>;
|
|
8
8
|
export type ConfigLoaded = {
|
|
9
|
-
addMetaComment: boolean;
|
|
9
|
+
addMetaComment: boolean | string;
|
|
10
10
|
assetsPath: string;
|
|
11
11
|
closingPrefix: string;
|
|
12
12
|
keywordPrefix: string;
|
|
@@ -28,7 +28,7 @@ export type RulesToLoad = Array<Rules | string> | Rules | string;
|
|
|
28
28
|
/**
|
|
29
29
|
* Load and validate mdat configuration / rule sets
|
|
30
30
|
* Uses cosmiconfig to search in the usual places.
|
|
31
|
-
* Merge precedence:
|
|
31
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
32
32
|
*
|
|
33
33
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
34
34
|
*/
|
|
@@ -48,6 +48,11 @@ export declare function loadConfig(options?: {
|
|
|
48
48
|
* Accepts an individual item, or an array. Objects in the array will be merged right to left, and take precedence over any rules in previously loaded Config objects as well.
|
|
49
49
|
*/
|
|
50
50
|
additionalRules?: RulesToLoad;
|
|
51
|
+
/**
|
|
52
|
+
* Readme-specific defaults that have higher priority than base defaults but lower than searched config.
|
|
53
|
+
* Used internally by loadConfigReadme.
|
|
54
|
+
*/
|
|
55
|
+
readmeDefaults?: Config;
|
|
51
56
|
/** Search for config in specific directories, mainly useful for testing. Cosmiconfig default search paths used if unset. */
|
|
52
57
|
searchFrom?: string;
|
|
53
58
|
}): Promise<ConfigLoaded>;
|
package/dist/index.js
CHANGED
|
@@ -3951,7 +3951,6 @@ ZodNaN.create = (params) => {
|
|
|
3951
3951
|
...processCreateParams(params)
|
|
3952
3952
|
});
|
|
3953
3953
|
};
|
|
3954
|
-
const BRAND = Symbol("zod_brand");
|
|
3955
3954
|
var ZodBranded = class extends ZodType {
|
|
3956
3955
|
_parse(input) {
|
|
3957
3956
|
const { ctx } = this._processInputParams(input);
|
|
@@ -4276,12 +4275,12 @@ const configSchema = optionsSchema.merge(objectType({
|
|
|
4276
4275
|
/**
|
|
4277
4276
|
* Load and validate mdat configuration / rule sets
|
|
4278
4277
|
* Uses cosmiconfig to search in the usual places.
|
|
4279
|
-
* Merge precedence:
|
|
4278
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
4280
4279
|
*
|
|
4281
4280
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
4282
4281
|
*/
|
|
4283
4282
|
async function loadConfig(options) {
|
|
4284
|
-
const { additionalConfig, additionalRules, searchFrom } = options ?? {};
|
|
4283
|
+
const { additionalConfig, additionalRules, readmeDefaults, searchFrom } = options ?? {};
|
|
4285
4284
|
let finalConfig = {
|
|
4286
4285
|
addMetaComment: false,
|
|
4287
4286
|
assetsPath: "./assets",
|
|
@@ -4291,6 +4290,7 @@ async function loadConfig(options) {
|
|
|
4291
4290
|
packageFile: await findPackage(),
|
|
4292
4291
|
rules: { mdat: `Powered by the Markdown Autophagic Template system: [mdat](https://github.com/kitschpatrol/mdat).` }
|
|
4293
4292
|
};
|
|
4293
|
+
if (readmeDefaults) finalConfig = deepMergeDefined(finalConfig, readmeDefaults);
|
|
4294
4294
|
const configExplorer = cosmiconfig("mdat", { loaders: { ".ts": TypeScriptLoader() } });
|
|
4295
4295
|
const results = await configExplorer.search(searchFrom);
|
|
4296
4296
|
if (results) {
|
|
@@ -24465,16 +24465,19 @@ var rules_default = {
|
|
|
24465
24465
|
//#endregion
|
|
24466
24466
|
//#region src/lib/readme/config.ts
|
|
24467
24467
|
/**
|
|
24468
|
-
* Convenience loader to always include the default readme config
|
|
24468
|
+
* Convenience loader to always include the default readme config.
|
|
24469
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
24470
|
+
* but higher priority than base mdat defaults.
|
|
24469
24471
|
*/
|
|
24470
24472
|
async function loadConfigReadme(options) {
|
|
24471
24473
|
const defaultReadmeConfig = {
|
|
24472
24474
|
addMetaComment: true,
|
|
24473
24475
|
rules: rules_default
|
|
24474
24476
|
};
|
|
24475
|
-
const { additionalConfig = [],...rest } = options ?? {};
|
|
24477
|
+
const { additionalConfig = [], readmeDefaults = defaultReadmeConfig,...rest } = options ?? {};
|
|
24476
24478
|
const result = await loadConfig({
|
|
24477
|
-
additionalConfig:
|
|
24479
|
+
additionalConfig: Array.isArray(additionalConfig) ? additionalConfig : [additionalConfig],
|
|
24480
|
+
readmeDefaults,
|
|
24478
24481
|
...rest
|
|
24479
24482
|
});
|
|
24480
24483
|
if (result.packageFile === void 0) throw new Error("Package file path is required in `mdat readme` config");
|
|
@@ -24482,7 +24485,7 @@ async function loadConfigReadme(options) {
|
|
|
24482
24485
|
}
|
|
24483
24486
|
|
|
24484
24487
|
//#endregion
|
|
24485
|
-
//#region node_modules/.pnpm/yocto-queue@1.2.
|
|
24488
|
+
//#region node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
24486
24489
|
var Node = class {
|
|
24487
24490
|
value;
|
|
24488
24491
|
next;
|
|
@@ -24513,6 +24516,7 @@ var Queue = class {
|
|
|
24513
24516
|
if (!current) return;
|
|
24514
24517
|
this.#head = this.#head.next;
|
|
24515
24518
|
this.#size--;
|
|
24519
|
+
if (!this.#head) this.#tail = void 0;
|
|
24516
24520
|
return current.value;
|
|
24517
24521
|
}
|
|
24518
24522
|
peek() {
|
package/dist/readme/config.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ type ReadmeConfigLoaded = Simplify<ConfigLoaded & {
|
|
|
6
6
|
}>;
|
|
7
7
|
type LoadConfigOptions = Parameters<typeof loadConfig>[0];
|
|
8
8
|
/**
|
|
9
|
-
* Convenience loader to always include the default readme config
|
|
9
|
+
* Convenience loader to always include the default readme config.
|
|
10
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
11
|
+
* but higher priority than base mdat defaults.
|
|
10
12
|
*/
|
|
11
13
|
export declare function loadConfigReadme(options?: LoadConfigOptions): Promise<ReadmeConfigLoaded>;
|
|
12
14
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "CLI tool and TypeScript library implementing the Markdown Autophagic Template (MDAT) system. MDAT lets you use comments as dynamic content templates in Markdown files, making it easy to generate and update readme boilerplate.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mdat",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@clack/prompts": "^0.11.0",
|
|
41
41
|
"@types/mdast": "^4.0.4",
|
|
42
|
-
"@types/node": "^22.19.
|
|
42
|
+
"@types/node": "^22.19.1",
|
|
43
43
|
"@types/unist": "^3.0.3",
|
|
44
44
|
"@types/yargs": "^17.0.34",
|
|
45
45
|
"cosmiconfig": "^9.0.0",
|
|
46
46
|
"cosmiconfig-typescript-loader": "^6.2.0",
|
|
47
47
|
"globby": "^14.1.0",
|
|
48
|
-
"read-pkg": "^
|
|
49
|
-
"remark-mdat": "^1.
|
|
48
|
+
"read-pkg": "^10.0.0",
|
|
49
|
+
"remark-mdat": "^1.2.0",
|
|
50
50
|
"type-fest": "^5.2.0",
|
|
51
51
|
"unified-engine": "^11.2.2",
|
|
52
52
|
"vfile": "^6.0.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@kitschpatrol/shared-config": "^5.8.
|
|
55
|
+
"@kitschpatrol/shared-config": "^5.8.3",
|
|
56
56
|
"bumpp": "^10.3.1",
|
|
57
57
|
"execa": "^9.6.0",
|
|
58
58
|
"find-up": "^8.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"remark": "^15.0.1",
|
|
72
72
|
"remark-gfm": "^4.0.1",
|
|
73
73
|
"to-vfile": "^8.0.0",
|
|
74
|
-
"tsdown": "^0.16.
|
|
74
|
+
"tsdown": "^0.16.3",
|
|
75
75
|
"typescript": "~5.9.3",
|
|
76
76
|
"unplugin-raw": "^0.6.3",
|
|
77
77
|
"untildify": "^6.0.0",
|
package/readme.md
CHANGED
|
@@ -269,18 +269,18 @@ mdat expand <files..> [options]
|
|
|
269
269
|
| ------------------- | -------------------------------------------------------------- | -------- |
|
|
270
270
|
| `files` | Markdown file(s) with MDAT placeholder comments. _(Required.)_ | `string` |
|
|
271
271
|
|
|
272
|
-
| Option | Description
|
|
273
|
-
| ------------------- |
|
|
274
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
275
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
276
|
-
| `--output`<br>`-o` | Output file directory.
|
|
277
|
-
| `--name`<br>`-n` | Output file name.
|
|
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.
|
|
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.
|
|
280
|
-
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options.
|
|
281
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
282
|
-
| `--help`<br>`-h` | Show help
|
|
283
|
-
| `--version`<br>`-v` | Show version number
|
|
272
|
+
| Option | Description | Type | Default |
|
|
273
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
274
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
275
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
276
|
+
| `--output`<br>`-o` | Output file directory. | `string` | Same directory as input file. |
|
|
277
|
+
| `--name`<br>`-n` | Output file name. | `string` | Same name as input file. Overwrites the input file. |
|
|
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
|
+
| `--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
|
+
| `--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 and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
282
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
283
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
284
284
|
|
|
285
285
|
#### Subcommand: `mdat check`
|
|
286
286
|
|
|
@@ -296,15 +296,15 @@ mdat check <files..> [options]
|
|
|
296
296
|
| ------------------- | -------------------------------------------------------------- | -------- |
|
|
297
297
|
| `files` | Markdown file(s) with MDAT placeholder comments. _(Required.)_ | `string` |
|
|
298
298
|
|
|
299
|
-
| Option | Description
|
|
300
|
-
| ------------------- |
|
|
301
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
302
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
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.
|
|
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.
|
|
305
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
306
|
-
| `--help`<br>`-h` | Show help
|
|
307
|
-
| `--version`<br>`-v` | Show version number
|
|
299
|
+
| Option | Description | Type | Default |
|
|
300
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
301
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
302
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
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
|
+
| `--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 and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
306
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
307
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
308
308
|
|
|
309
309
|
#### Subcommand: `mdat collapse`
|
|
310
310
|
|
|
@@ -368,20 +368,20 @@ mdat readme expand [files..] [options]
|
|
|
368
368
|
| ------------------- | --------------------------------------------------------------------------------------------------- | -------- |
|
|
369
369
|
| `files` | Readme file(s) with MDAT placeholder comments. If not provided, the closest readme.md file is used. | `string` |
|
|
370
370
|
|
|
371
|
-
| Option | Description
|
|
372
|
-
| ------------------- |
|
|
373
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
374
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
375
|
-
| `--output`<br>`-o` | Output file directory.
|
|
376
|
-
| `--name`<br>`-n` | Output file name.
|
|
377
|
-
| `--package` | Path to the package.json file to use to populate the readme.
|
|
378
|
-
| `--assets` | Path to find and save readme-related assets.
|
|
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.
|
|
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.
|
|
381
|
-
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options.
|
|
382
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
383
|
-
| `--help`<br>`-h` | Show help
|
|
384
|
-
| `--version`<br>`-v` | Show version number
|
|
371
|
+
| Option | Description | Type | Default |
|
|
372
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
373
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
374
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
375
|
+
| `--output`<br>`-o` | Output file directory. | `string` | Same directory as input file. |
|
|
376
|
+
| `--name`<br>`-n` | Output file name. | `string` | Same name as input file. Overwrites the input file. |
|
|
377
|
+
| `--package` | Path to the package.json file to use to populate the readme. | `string` | The closest package.json file is used by default. |
|
|
378
|
+
| `--assets` | Path to find and save readme-related assets. | `string` | `./assets` |
|
|
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
|
+
| `--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
|
+
| `--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 and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
383
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
384
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
385
385
|
|
|
386
386
|
#### Subcommand: `mdat readme check`
|
|
387
387
|
|
|
@@ -397,17 +397,17 @@ mdat readme check [files..] [options]
|
|
|
397
397
|
| ------------------- | --------------------------------------------------------------------------------------------------- | -------- |
|
|
398
398
|
| `files` | Readme file(s) with MDAT placeholder comments. If not provided, the closest readme.md file is used. | `string` |
|
|
399
399
|
|
|
400
|
-
| Option | Description
|
|
401
|
-
| ------------------- |
|
|
402
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
403
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
404
|
-
| `--package` | Path to the package.json file to use to populate the readme.
|
|
405
|
-
| `--assets` | Path to find and save readme-related assets.
|
|
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.
|
|
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.
|
|
408
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
409
|
-
| `--help`<br>`-h` | Show help
|
|
410
|
-
| `--version`<br>`-v` | Show version number
|
|
400
|
+
| Option | Description | Type | Default |
|
|
401
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
402
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
403
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
404
|
+
| `--package` | Path to the package.json file to use to populate the readme. | `string` | The closest package.json file is used by default. |
|
|
405
|
+
| `--assets` | Path to find and save readme-related assets. | `string` | `./assets` |
|
|
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
|
+
| `--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 and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
409
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
410
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
411
411
|
|
|
412
412
|
#### Subcommand: `mdat readme collapse`
|
|
413
413
|
|
|
@@ -638,7 +638,7 @@ The `mdat` configuration file is a record object allowing you to customize aspec
|
|
|
638
638
|
|
|
639
639
|
```ts
|
|
640
640
|
type Config = {
|
|
641
|
-
addMetaComment?: boolean // Defaults to true
|
|
641
|
+
addMetaComment?: boolean | string // Defaults to true. If a string is provided, it will be used as the meta comment content.
|
|
642
642
|
assetsPath?: string // Where asset-generating rules should store their output, defaults to './assets'
|
|
643
643
|
closingPrefix?: string // Defaults to '/'
|
|
644
644
|
keywordPrefix?: string // Defaults to ''
|
|
@@ -750,7 +750,7 @@ See the [Examples section](https://github.com/kitschpatrol/remark-mdat#examples)
|
|
|
750
750
|
| File | Original | Gzip | Brotli |
|
|
751
751
|
| ------------ | -------- | ------- | ------ |
|
|
752
752
|
| package.json | 2.5 kB | 1.1 kB | 974 B |
|
|
753
|
-
| readme.md |
|
|
753
|
+
| readme.md | 63.9 kB | 11.6 kB | 9.3 kB |
|
|
754
754
|
|
|
755
755
|
<!-- /size-table -->
|
|
756
756
|
|
|
@@ -796,7 +796,7 @@ The `init` command provides a number of "starter readme" templates incorporating
|
|
|
796
796
|
|
|
797
797
|
## Plugins
|
|
798
798
|
|
|
799
|
-
Rule plugins are packages that
|
|
799
|
+
Rule plugins are packages that simplify sharing mdat expansion rules across multiple projects.
|
|
800
800
|
|
|
801
801
|
### Installing a rule plugin
|
|
802
802
|
|
|
@@ -845,7 +845,7 @@ Hello from the [mdat](https://github.com/kitschpatrol/mdat) example plugin!
|
|
|
845
845
|
|
|
846
846
|
### Creating a rule plugin
|
|
847
847
|
|
|
848
|
-
A rule plugin is a ESM module or npm package with a default export of or more mdat rules.
|
|
848
|
+
A rule plugin is a ESM module or npm package with a default export of one or more mdat rules.
|
|
849
849
|
|
|
850
850
|
If you just need a quick one-off rule specific to your project, you can define it directly in your `mdat.config.ts` file. A plugin is only necessary if you want to share the rule or use it across multiple projects.
|
|
851
851
|
|