@topik/remark-tags 0.1.0-alpha.6 → 0.1.0-alpha.7

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 CHANGED
@@ -35,8 +35,8 @@ The default export and named `remarkTags` export refer to the same plugin. This
35
35
  an ESM package requiring Node.js 22.12 or later.
36
36
 
37
37
  Contributor tooling uses the workspace's `.node-version` and requires
38
- `^22.18.0 || ^24.11.0 || >=26.0.0` for Vite+ 1.0 and Vitest 5. CI verifies the
39
- built library on Node.js 22.12 separately from the test runner.
38
+ `^22.23.4 || ^24.11.0 || >=26.0.0` for Vite+, Vitest, and Astro integration
39
+ tests. CI verifies the built library on Node.js 22.12 separately from the test runner.
40
40
 
41
41
  ## Syntax
42
42
 
package/dist/index.d.mts CHANGED
@@ -3,7 +3,6 @@ import { Extension } from "mdast-util-from-markdown";
3
3
  import { Options } from "mdast-util-to-markdown";
4
4
  import { Extension as Extension$1 } from "micromark-util-types";
5
5
  import { Plugin } from "unified";
6
- //#region src/types.d.ts
7
6
  export type TagDeclarations = Record<string, {
8
7
  kind: "inline" | "block";
9
8
  }>;
@@ -100,8 +99,6 @@ export declare class TagSyntaxError extends Error {
100
99
  readonly diagnostics: TagDiagnostic[];
101
100
  constructor(diagnostics: TagDiagnostic[]);
102
101
  }
103
- //#endregion
104
- //#region src/syntax.d.ts
105
102
  declare module "micromark-util-types" {
106
103
  interface TokenTypeMap {
107
104
  topikTextTag: "topikTextTag";
@@ -110,12 +107,8 @@ declare module "micromark-util-types" {
110
107
  }
111
108
  /** Recognize markers without consuming the Markdown between paired tags. */
112
109
  export declare function tagSyntax(declarations: TagDeclarations, options?: TagSyntaxOptions): Extension$1;
113
- //#endregion
114
- //#region src/from-markdown.d.ts
115
110
  /** Build tag nodes after Markdown has established block and phrasing boundaries. */
116
111
  export declare function tagFromMarkdown(declarations: TagDeclarations, options?: TagSyntaxOptions): Extension;
117
- //#endregion
118
- //#region src/to-markdown.d.ts
119
112
  declare module "mdast-util-to-markdown" {
120
113
  interface ConstructNameMap {
121
114
  tagText: "tagText";
@@ -123,12 +116,8 @@ declare module "mdast-util-to-markdown" {
123
116
  }
124
117
  /** Serialize tag nodes using the host writer for their Markdown children. */
125
118
  export declare function tagToMarkdown(declarations: TagDeclarations, options?: TagSyntaxOptions): Options;
126
- //#endregion
127
- //#region src/templates.d.ts
128
119
  /** Normalize complete literal runs before escaping, including caller-constructed segments. */
129
120
  export declare function writeTextTemplate(template: unknown, code?: boolean): string;
130
- //#endregion
131
- //#region src/index.d.ts
132
121
  declare module "unified" {
133
122
  interface Data {
134
123
  micromarkExtensions?: Extension$1[];
@@ -138,5 +127,4 @@ declare module "unified" {
138
127
  }
139
128
  /** Add declarative tag parsing and serialization to a remark processor. */
140
129
  export declare const remarkTags: Plugin<[TagDeclarations, TagSyntaxOptions?], Root>;
141
- //#endregion
142
130
  export { remarkTags as default };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/types.ts
1
+ // src/types.ts
2
2
  /** Bounds on both the incoming mdast tree and the converted tag tree. */
3
3
  const TAG_LIMITS = Object.freeze({
4
4
  treeDepth: 128,
@@ -13,8 +13,7 @@ var TagSyntaxError = class extends Error {
13
13
  this.name = "TagSyntaxError";
14
14
  }
15
15
  };
16
- //#endregion
17
- //#region src/templates.ts
16
+ // src/templates.ts
18
17
  const token = new RegExp(`^\\{%[ \\t]*\\$([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*)[ \\t]*%\\}$`);
19
18
  const identifier = /^[A-Za-z_][A-Za-z0-9_]*$/;
20
19
  const unsafeKeys = /* @__PURE__ */ new Set([
@@ -161,8 +160,7 @@ function writeTextTemplate(template, code = false) {
161
160
  flush();
162
161
  return result.join("");
163
162
  }
164
- //#endregion
165
- //#region src/grammar.ts
163
+ // src/grammar.ts
166
164
  function validateDeclarations(declarations, options = {}) {
167
165
  for (const [name, declaration] of Object.entries(declarations)) {
168
166
  if (!/^[a-z][A-Za-z0-9-]*$/.test(name)) throw new Error(`Invalid tag declaration ${name}`);
@@ -304,8 +302,7 @@ function parseTag(raw, options) {
304
302
  attributes
305
303
  };
306
304
  }
307
- //#endregion
308
- //#region src/syntax.ts
305
+ // src/syntax.ts
309
306
  const horizontal = (code) => code === 32 || code === -2 || code === -1;
310
307
  const lineEnd = (code) => code === null || code < -2;
311
308
  const lower = (code) => code !== null && code >= 97 && code <= 122;
@@ -461,8 +458,7 @@ function tagSyntax(declarations, options = {}) {
461
458
  };
462
459
  }
463
460
  }
464
- //#endregion
465
- //#region src/from-markdown.ts
461
+ // src/from-markdown.ts
466
462
  function isMarker(node) {
467
463
  return node.type === "topikTagMarker";
468
464
  }
@@ -759,8 +755,7 @@ function tagFromMarkdown(declarations, options = {}) {
759
755
  };
760
756
  }
761
757
  }
762
- //#endregion
763
- //#region src/to-markdown.ts
758
+ // src/to-markdown.ts
764
759
  function attributeEntries(node) {
765
760
  const property = Object.getOwnPropertyDescriptor(node, "attributes");
766
761
  if (!property) {
@@ -958,8 +953,7 @@ function tagToMarkdown(declarations, options = {}) {
958
953
  handlers
959
954
  };
960
955
  }
961
- //#endregion
962
- //#region src/index.ts
956
+ // src/index.ts
963
957
  /** Add declarative tag parsing and serialization to a remark processor. */
964
958
  const remarkTags = function(declarations, options = {}) {
965
959
  const data = this.data();
@@ -967,5 +961,4 @@ const remarkTags = function(declarations, options = {}) {
967
961
  (data.fromMarkdownExtensions ??= []).push(tagFromMarkdown(declarations, options));
968
962
  (data.toMarkdownExtensions ??= []).push(tagToMarkdown(declarations, options));
969
963
  };
970
- //#endregion
971
964
  export { TAG_LIMITS, TagSyntaxError, remarkTags as default, remarkTags, tagFromMarkdown, tagSyntax, tagToMarkdown, writeTextTemplate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topik/remark-tags",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.7",
4
4
  "description": "Markdoc-style declarative tag syntax for remark and mdast",
5
5
  "keywords": [
6
6
  "markdown",
@@ -31,28 +31,28 @@
31
31
  "@types/mdast": "^4.0.4",
32
32
  "@types/unist": "^3.0.3",
33
33
  "mdast-util-from-markdown": "^2.1.0",
34
- "mdast-util-to-markdown": "^2.1.2",
35
- "micromark-util-types": "^2.0.2",
34
+ "mdast-util-to-markdown": "^2.2.1",
35
+ "micromark-util-types": "^2.0.3",
36
36
  "unified": "^11.0.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "22.20.4",
40
- "@vitest/coverage-v8": "5.0.4",
41
- "mdast-util-directive": "^3.1.0",
39
+ "@types/node": "22.20.5",
40
+ "@vitest/coverage-v8": "5.0.5",
41
+ "mdast-util-directive": "^3.2.0",
42
42
  "mdast-util-gfm": "^3.1.0",
43
43
  "micromark-extension-directive": "^4.0.0",
44
44
  "micromark-extension-gfm": "^3.0.0",
45
45
  "remark-parse": "^11.0.0",
46
46
  "remark-stringify": "^11.0.0",
47
47
  "typescript": "^7.0.2",
48
- "vite": "npm:@voidzero-dev/vite-plus-core@1.2.0",
49
- "vite-plus": "1.2.0",
50
- "vitest": "5.0.4"
48
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
49
+ "vite-plus": "1.4.0",
50
+ "vitest": "5.0.5"
51
51
  },
52
52
  "devEngines": {
53
53
  "runtime": {
54
54
  "name": "node",
55
- "version": "^22.18.0 || ^24.11.0 || >=26.0.0"
55
+ "version": "^22.23.4 || ^24.11.0 || >=26.0.0"
56
56
  }
57
57
  },
58
58
  "engines": {