remark-mdat 2.2.0 → 2.2.2
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/index.d.ts +11 -5
- package/dist/index.js +6 -4
- package/package.json +14 -13
- package/readme.md +12 -13
package/dist/index.d.ts
CHANGED
|
@@ -193,11 +193,13 @@ declare function mdatStrip(tree: Root, _file: VFile): void;
|
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/lib/mdat/log.d.ts
|
|
195
195
|
/**
|
|
196
|
-
* Set the logger instance for the module.
|
|
197
|
-
*
|
|
198
|
-
*
|
|
196
|
+
* Set the logger instance for the module. Export this for library consumers to
|
|
197
|
+
* inject their own logger.
|
|
198
|
+
*
|
|
199
|
+
* @param logger - Accepts either a LogLayer instance or a Console- or
|
|
200
|
+
* Stream-like log target
|
|
199
201
|
*/
|
|
200
|
-
declare function setLogger(logger?: ILogBasic | ILogLayer): void;
|
|
202
|
+
declare function setLogger(logger?: ILogBasic | ILogLayer<unknown>): void;
|
|
201
203
|
//#endregion
|
|
202
204
|
//#region src/lib/mdat/mdat-log.d.ts
|
|
203
205
|
/** A simplified representation of a {@link VFileMessage}. */
|
|
@@ -224,7 +226,11 @@ declare function reporterMdat(files: VFile[]): void;
|
|
|
224
226
|
//#region src/lib/remark-mdat.d.ts
|
|
225
227
|
/** Configuration for the remarkMdat plugin. */
|
|
226
228
|
type Options = {
|
|
227
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Rules mapping comment keywords to expansion content. Merged with built-in
|
|
231
|
+
* defaults.
|
|
232
|
+
*/
|
|
233
|
+
rules?: Rules;
|
|
228
234
|
};
|
|
229
235
|
/** Zod schema for validating {@link Options}. */
|
|
230
236
|
declare const optionsSchema: z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -19,9 +19,11 @@ let log = createLogger({
|
|
|
19
19
|
name: "remark-mdat"
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
|
-
* Set the logger instance for the module.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Set the logger instance for the module. Export this for library consumers to
|
|
23
|
+
* inject their own logger.
|
|
24
|
+
*
|
|
25
|
+
* @param logger - Accepts either a LogLayer instance or a Console- or
|
|
26
|
+
* Stream-like log target
|
|
25
27
|
*/
|
|
26
28
|
function setLogger(logger) {
|
|
27
29
|
log = injectionHelper(logger);
|
|
@@ -456,7 +458,7 @@ function splitHtmlIntoMdastNodes(mdastNode) {
|
|
|
456
458
|
return mdastNodes;
|
|
457
459
|
}
|
|
458
460
|
function addStartPoint(position, start) {
|
|
459
|
-
if (position === void 0 || start === void 0) return
|
|
461
|
+
if (position === void 0 || start === void 0) return;
|
|
460
462
|
const startLine = position.start.line - 1 + start.line;
|
|
461
463
|
const endLine = position.end.line - 1 + start.line;
|
|
462
464
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remark-mdat",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A remark plugin implementing the Markdown Autophagic Template (MDAT) system.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mdat",
|
|
@@ -46,27 +46,28 @@
|
|
|
46
46
|
"gray-matter-es": "^0.2.1",
|
|
47
47
|
"hast-util-from-html": "^2.0.3",
|
|
48
48
|
"json5": "^2.2.3",
|
|
49
|
-
"lognow": "^0.6.
|
|
49
|
+
"lognow": "^0.6.1",
|
|
50
50
|
"picocolors": "^1.1.1",
|
|
51
51
|
"remark": "^15.0.1",
|
|
52
52
|
"remark-gfm": "^4.0.1",
|
|
53
|
-
"type-fest": "^5.
|
|
53
|
+
"type-fest": "^5.6.0",
|
|
54
54
|
"unified": "^11.0.5",
|
|
55
55
|
"unist-util-visit": "^5.1.0",
|
|
56
56
|
"vfile": "^6.0.3",
|
|
57
57
|
"vfile-message": "^4.0.3",
|
|
58
|
-
"zod": "^4.
|
|
58
|
+
"zod": "^4.4.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@arethetypeswrong/core": "^0.18.2",
|
|
62
|
-
"@kitschpatrol/shared-config": "^7.
|
|
63
|
-
"@types/node": "~20.19.
|
|
64
|
-
"@vitest/coverage-v8": "^4.1.
|
|
62
|
+
"@kitschpatrol/shared-config": "^7.5.2",
|
|
63
|
+
"@types/node": "~20.19.39",
|
|
64
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
65
65
|
"bumpp": "^11.0.1",
|
|
66
66
|
"publint": "^0.3.18",
|
|
67
|
-
"
|
|
67
|
+
"shx": "^0.4.0",
|
|
68
|
+
"tsdown": "^0.21.10",
|
|
68
69
|
"typescript": "~5.9.3",
|
|
69
|
-
"vitest": "^4.1.
|
|
70
|
+
"vitest": "^4.1.5"
|
|
70
71
|
},
|
|
71
72
|
"engines": {
|
|
72
73
|
"node": ">=20.19.6"
|
|
@@ -81,13 +82,13 @@
|
|
|
81
82
|
"bench": "vitest bench --run --no-file-parallelism --compare test/benchmarks/baseline.json",
|
|
82
83
|
"bench:baseline": "vitest bench --run --no-file-parallelism --outputJson test/benchmarks/baseline.json",
|
|
83
84
|
"build": "tsdown",
|
|
84
|
-
"clean": "
|
|
85
|
+
"clean": "shx rm -f pnpm-lock.yaml && git clean -fdX -e !.claude/",
|
|
85
86
|
"coverage": "vitest --coverage --run",
|
|
86
|
-
"dev": "pnpm
|
|
87
|
+
"dev": "pnpm test",
|
|
87
88
|
"fix": "ksc fix",
|
|
88
89
|
"lint": "ksc lint",
|
|
89
|
-
"release": "bumpp --commit 'Release: %s' && pnpm
|
|
90
|
-
"release-preview": "bumpp --preid preview --commit 'Release: %s' && pnpm
|
|
90
|
+
"release": "bumpp --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') && pnpm publish",
|
|
91
|
+
"release-preview": "bumpp --preid preview --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') && pnpm publish --tag preview",
|
|
91
92
|
"test": "vitest run"
|
|
92
93
|
}
|
|
93
94
|
}
|
package/readme.md
CHANGED
|
@@ -4,17 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- /title -->
|
|
6
6
|
|
|
7
|
-
<!-- badges
|
|
8
|
-
"CI": {
|
|
9
|
-
image: "https://github.com/kitschpatrol/remark-mdat/actions/workflows/ci.yml/badge.svg",
|
|
10
|
-
link: "https://github.com/kitschpatrol/remark-mdat/actions/workflows/ci.yml",
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
-->
|
|
7
|
+
<!-- badges -->
|
|
15
8
|
|
|
16
9
|
[](https://npmjs.com/package/remark-mdat)
|
|
17
|
-
[](https://opensource.org/
|
|
10
|
+
[](https://opensource.org/license/mit/)
|
|
18
11
|
[](https://github.com/kitschpatrol/remark-mdat/actions/workflows/ci.yml)
|
|
19
12
|
|
|
20
13
|
<!-- /badges -->
|
|
@@ -361,6 +354,8 @@ The former `mdast-util-mdat-clean` / `mdatClean` is now `mdast-util-mdat-collaps
|
|
|
361
354
|
|
|
362
355
|
The `mdast-util-mdat-check` utility and its export `mdatCheck` have been removed. Validation logic (missing rules, empty content, rule errors) is now handled inline during expansion by `mdatExpand`, which reports issues as VFile messages. Use `reporterMdat` to format and display these messages.
|
|
363
356
|
|
|
357
|
+
For use cases where you need to check whether a file's expansions are up to date without modifying it (similar to `validate` in 1.x), use the new `mdatDiff` utility. It compares an original document against a freshly expanded version per-tag, identifying stale, unexpanded, or missing comments and reporting structured results.
|
|
358
|
+
|
|
364
359
|
### Rule function signature change
|
|
365
360
|
|
|
366
361
|
In 1.x, rule content functions received the mdast tree directly as the second argument:
|
|
@@ -387,7 +382,7 @@ In 1.x, the argument parser was very permissive — parentheses were optional, b
|
|
|
387
382
|
|
|
388
383
|
```md
|
|
389
384
|
<!-- greeting name: "Alice" -->
|
|
390
|
-
<!-- greeting {name: "Alice"} -->
|
|
385
|
+
<!-- greeting ({name: "Alice"}) -->
|
|
391
386
|
<!-- greeting({name: "Alice"}) -->
|
|
392
387
|
```
|
|
393
388
|
|
|
@@ -427,7 +422,7 @@ Remark is not a peer dependency on account of this discussion: [strip-markdown/i
|
|
|
427
422
|
|
|
428
423
|
## Maintainers
|
|
429
424
|
|
|
430
|
-
[
|
|
425
|
+
[kitschpatrol](https://github.com/kitschpatrol)
|
|
431
426
|
|
|
432
427
|
## Acknowledgments
|
|
433
428
|
|
|
@@ -437,10 +432,14 @@ Thanks to the [unified team](https://github.com/orgs/unifiedjs/people) for their
|
|
|
437
432
|
|
|
438
433
|
## Contributing
|
|
439
434
|
|
|
440
|
-
[Issues](https://github.com/kitschpatrol/remark-mdat/issues)
|
|
435
|
+
[Issues](https://github.com/kitschpatrol/remark-mdat/issues) are welcome and appreciated.
|
|
436
|
+
|
|
437
|
+
Please open an issue to discuss changes before submitting a pull request. Unsolicited PRs (especially AI-generated ones) are unlikely to be merged.
|
|
438
|
+
|
|
439
|
+
This repository uses [@kitschpatrol/shared-config](https://github.com/kitschpatrol/shared-config) (via its `ksc` CLI) for linting and formatting, plus [MDAT](https://github.com/kitschpatrol/mdat) for readme placeholder expansion.
|
|
441
440
|
|
|
442
441
|
## License
|
|
443
442
|
|
|
444
|
-
[MIT](license.txt) © Eric Mika
|
|
443
|
+
[MIT](license.txt) © [Eric Mika](https://ericmika.com)
|
|
445
444
|
|
|
446
445
|
<!-- /footer -->
|