create-zudo-doc 2.3.0 → 2.4.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.
@@ -11,5 +11,5 @@ export { getSecondaryLang };
11
11
  *
12
12
  * Bumped in lockstep by scripts/release-create-zudo-doc.sh.
13
13
  */
14
- export declare const ZUDO_DOC_PIN = "^2.3.0";
14
+ export declare const ZUDO_DOC_PIN = "^2.4.0";
15
15
  export declare function scaffold(choices: UserChoices): Promise<void>;
package/dist/scaffold.js CHANGED
@@ -18,7 +18,7 @@ export { getSecondaryLang };
18
18
  *
19
19
  * Bumped in lockstep by scripts/release-create-zudo-doc.sh.
20
20
  */
21
- export const ZUDO_DOC_PIN = "^2.3.0";
21
+ export const ZUDO_DOC_PIN = "^2.4.0";
22
22
  /**
23
23
  * Files in `templates/base/**` that must never be copied into a generated
24
24
  * project. Each entry is matched against the path relative to `templates/base/`
@@ -580,7 +580,7 @@ function generatePackageJson(choices) {
580
580
  // @takazudo/zudo-doc/integrations/doc-history which in turn imports
581
581
  // @takazudo/zudo-doc-history-server/git-history. Without this dep the
582
582
  // plugin host fails at init with ERR_MODULE_NOT_FOUND — W8A (#1739).
583
- deps["@takazudo/zudo-doc-history-server"] = "^2.3.0";
583
+ deps["@takazudo/zudo-doc-history-server"] = "^2.4.0";
584
584
  // tsx is no longer needed here: the relocated package plugin imports the
585
585
  // runner directly (no `tsx -e` spawn) since the package ships compiled
586
586
  // dist/ — package-first migration #2321 (#2337).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zudo-doc",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Create a new zudo-doc documentation site",
5
5
  "license": "MIT",
6
6
  "author": "Takeshi Takatsudo",
@@ -31,4 +31,12 @@ describe("escapeForMdx", () => {
31
31
  it("escapes self-closing non-allowlisted component tags", () => {
32
32
  expect(escapeForMdx("<Component />")).toMatch(/&lt;Component\s*\/&gt;/);
33
33
  });
34
+
35
+ it("escapes the compact self-closing form <Foo/> (no space before slash)", () => {
36
+ // Regression: the opening-tag regex only matches the spaced form <Foo />,
37
+ // so the compact <Foo/> needs the dedicated self-closing branch.
38
+ const out = escapeForMdx("<Foo/>");
39
+ expect(out).toBe("&lt;Foo/&gt;");
40
+ expect(out).not.toContain("<Foo/>");
41
+ });
34
42
  });
@@ -67,7 +67,11 @@ export function escapeForMdx(content: string): string {
67
67
  return `&lt;/${name}&gt;`;
68
68
  },
69
69
  )
70
- // Escape self-closing tags: <Name />
70
+ // Escape self-closing tags. The spaced form <Foo /> is already handled
71
+ // by the opening-tag regex above ((\s[^>]*)? matches " /", then > closes),
72
+ // but the COMPACT form <Foo/> (no space before the slash) is NOT — the
73
+ // name is consumed, (\s[^>]*)? matches empty, then the regex needs ">"
74
+ // and finds "/". So this branch is still required for the compact form.
71
75
  .replace(
72
76
  /<([A-Za-z][A-Za-z0-9_-]*)(\s[^>]*)?\s*\/>/g,
73
77
  (match, name: string) => {
@@ -84,7 +88,7 @@ export function escapeForMdx(content: string): string {
84
88
  // Restore inline code placeholders
85
89
  escaped = escaped.replace(
86
90
  new RegExp(`${inlinePlaceholder}(\\d+)\x00`, "g"),
87
- (_, idx: string) => inlineCodes[Number(idx)],
91
+ (_, idx: string) => inlineCodes[Number(idx)] ?? "",
88
92
  );
89
93
 
90
94
  return escaped;