remark-mdat 1.1.3 → 1.2.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/dist/index.js CHANGED
@@ -4170,8 +4170,9 @@ function checkCommentOrder(file, comments) {
4170
4170
  function checkMetaCommentPresence(file, comments, options) {
4171
4171
  const { addMetaComment } = options;
4172
4172
  const metaCommentCount = comments.filter((comment) => comment.type === "meta").length;
4173
- if (addMetaComment && metaCommentCount !== 1) saveLog(file, "error", "check", `Missing meta comment`);
4174
- if (!addMetaComment && metaCommentCount !== 0) saveLog(file, "error", "check", `Unexpected meta comment`);
4173
+ const shouldHaveMetaComment = typeof addMetaComment === "string" ? true : addMetaComment;
4174
+ if (shouldHaveMetaComment && metaCommentCount !== 1) saveLog(file, "error", "check", `Missing meta comment`);
4175
+ if (!shouldHaveMetaComment && metaCommentCount !== 0) saveLog(file, "error", "check", `Unexpected meta comment`);
4175
4176
  if (metaCommentCount > 1) saveLog(file, "error", "check", `Multiple meta comments`);
4176
4177
  }
4177
4178
  function commentOrderList(comments) {
@@ -20792,7 +20793,7 @@ async function mdatExpand(tree, file, options) {
20792
20793
  if (addMetaComment) {
20793
20794
  const metaComment = {
20794
20795
  type: "html",
20795
- value: `<!--${metaCommentIdentifier} Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. ${metaCommentIdentifier}-->`
20796
+ value: `<!--${metaCommentIdentifier} ${typeof addMetaComment === "string" ? addMetaComment : "Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten."} ${metaCommentIdentifier}-->`
20796
20797
  };
20797
20798
  tree.children.unshift(metaComment);
20798
20799
  }
@@ -30564,7 +30565,7 @@ const defaultOptions = {
30564
30565
  rules: { mdat: `Powered by the Markdown Autophagic Template system: [mdat](https://github.com/kitschpatrol/mdat).` }
30565
30566
  };
30566
30567
  const optionsSchema = z.object({
30567
- addMetaComment: z.boolean().optional(),
30568
+ addMetaComment: z.union([z.boolean(), z.string()]).optional(),
30568
30569
  closingPrefix: z.string().optional(),
30569
30570
  keywordPrefix: z.string().optional(),
30570
30571
  metaCommentIdentifier: z.string().optional(),
@@ -2,7 +2,7 @@ import type { Root } from 'mdast';
2
2
  import type { VFile } from 'vfile';
3
3
  import type { Rules } from '../mdat/rules';
4
4
  export type Options = {
5
- addMetaComment: boolean;
5
+ addMetaComment: boolean | string;
6
6
  closingPrefix: string;
7
7
  keywordPrefix: string;
8
8
  metaCommentIdentifier: string;
@@ -2,7 +2,7 @@ import type { Root } from 'mdast';
2
2
  import type { VFile } from 'vfile';
3
3
  import type { Rules } from '../mdat/rules';
4
4
  export type Options = {
5
- addMetaComment: boolean;
5
+ addMetaComment: boolean | string;
6
6
  closingPrefix: string;
7
7
  keywordPrefix: string;
8
8
  metaCommentIdentifier: string;
@@ -2,7 +2,7 @@ import type { Root } from 'mdast';
2
2
  import type { VFile } from 'vfile';
3
3
  import type { Rules } from '../mdat/rules';
4
4
  export type Options = {
5
- addMetaComment: boolean;
5
+ addMetaComment: boolean | string;
6
6
  closingPrefix: string;
7
7
  keywordPrefix: string;
8
8
  metaCommentIdentifier: string;
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
  import type { Options as MdatOptions } from './mdast-utils/mdast-util-mdat';
5
5
  export type Options = Partial<MdatOptions>;
6
6
  export declare const optionsSchema: z.ZodObject<{
7
- addMetaComment: z.ZodOptional<z.ZodBoolean>;
7
+ addMetaComment: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
8
8
  closingPrefix: z.ZodOptional<z.ZodString>;
9
9
  keywordPrefix: z.ZodOptional<z.ZodString>;
10
10
  metaCommentIdentifier: z.ZodOptional<z.ZodString>;
@@ -14,13 +14,13 @@ export declare const optionsSchema: z.ZodObject<{
14
14
  keywordPrefix?: string | undefined;
15
15
  metaCommentIdentifier?: string | undefined;
16
16
  rules?: Record<string, any> | undefined;
17
- addMetaComment?: boolean | undefined;
17
+ addMetaComment?: string | boolean | undefined;
18
18
  }, {
19
19
  closingPrefix?: string | undefined;
20
20
  keywordPrefix?: string | undefined;
21
21
  metaCommentIdentifier?: string | undefined;
22
22
  rules?: Record<string, any> | undefined;
23
- addMetaComment?: boolean | undefined;
23
+ addMetaComment?: string | boolean | undefined;
24
24
  }>;
25
25
  /**
26
26
  * A remark plugin that expands HTML comments in Markdown files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remark-mdat",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "A remark plugin implementing the Markdown Autophagic Template (MDAT) system.",
5
5
  "keywords": [
6
6
  "mdat",
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@types/mdast": "^4.0.4",
38
- "@types/node": "^20.19.24",
38
+ "@types/node": "^20.19.25",
39
39
  "@types/unist": "^3.0.3",
40
40
  "picocolors": "^1.1.1",
41
41
  "type-fest": "^5.2.0",
@@ -44,7 +44,7 @@
44
44
  "zod": "^3.25.76"
45
45
  },
46
46
  "devDependencies": {
47
- "@kitschpatrol/shared-config": "^5.8.1",
47
+ "@kitschpatrol/shared-config": "^5.8.3",
48
48
  "bumpp": "^10.3.1",
49
49
  "cli-table3": "^0.6.5",
50
50
  "deepmerge-ts": "^7.1.5",
@@ -52,11 +52,11 @@
52
52
  "json5": "^2.2.3",
53
53
  "remark": "^15.0.1",
54
54
  "remark-gfm": "^4.0.1",
55
- "tsdown": "^0.16.0",
55
+ "tsdown": "^0.16.3",
56
56
  "typescript": "~5.9.3",
57
57
  "unist-util-visit": "^5.0.0",
58
58
  "vfile-message": "^4.0.3",
59
- "vitest": "^4.0.7"
59
+ "vitest": "^4.0.8"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=20.19.0"
package/readme.md CHANGED
@@ -101,7 +101,7 @@ The plugin accepts an optional options object which exposes some configuration o
101
101
 
102
102
  ```ts
103
103
  export type Options = {
104
- addMetaComment?: boolean // Default: false
104
+ addMetaComment?: boolean | string // Default: false
105
105
  closingPrefix?: string // Default: '/',
106
106
  keywordPrefix?: string // Default: '',
107
107
  metaCommentIdentifier?: string // Default: '+',