compmark-vue 0.2.2 → 0.2.4

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/cli.mjs CHANGED
@@ -445,6 +445,9 @@ function stringifyDefault(node, source) {
445
445
  }
446
446
  //#endregion
447
447
  //#region src/markdown.ts
448
+ function esc(value) {
449
+ return value.replaceAll("|", "\\|");
450
+ }
448
451
  function generateMarkdown(doc) {
449
452
  const sections = [`# ${doc.name}`];
450
453
  if (doc.description) sections.push("", doc.description);
@@ -469,7 +472,7 @@ function generateMarkdown(doc) {
469
472
  if (p.since) desc += ` *(since ${p.since})*`;
470
473
  if (p.see) desc += ` See: ${p.see}`;
471
474
  const req = p.required ? "Yes" : "No";
472
- sections.push(`| ${p.name} | ${p.type} | ${req} | ${def} | ${desc} |`);
475
+ sections.push(`| ${esc(p.name)} | ${esc(p.type)} | ${req} | ${esc(def)} | ${esc(desc)} |`);
473
476
  if (p.example) examples.push({
474
477
  name: p.name,
475
478
  example: p.example
@@ -484,7 +487,7 @@ function generateMarkdown(doc) {
484
487
  for (const e of doc.emits) {
485
488
  const desc = e.description || "-";
486
489
  const payload = e.payload || "-";
487
- sections.push(`| ${e.name} | ${payload} | ${desc} |`);
490
+ sections.push(`| ${esc(e.name)} | ${esc(payload)} | ${esc(desc)} |`);
488
491
  }
489
492
  } else {
490
493
  sections.push("", "## Emits", "");
@@ -492,7 +495,7 @@ function generateMarkdown(doc) {
492
495
  sections.push("| --- | --- |");
493
496
  for (const e of doc.emits) {
494
497
  const desc = e.description || "-";
495
- sections.push(`| ${e.name} | ${desc} |`);
498
+ sections.push(`| ${esc(e.name)} | ${esc(desc)} |`);
496
499
  }
497
500
  }
498
501
  if (hasSlots) {
@@ -502,7 +505,7 @@ function generateMarkdown(doc) {
502
505
  for (const s of doc.slots) {
503
506
  const desc = s.description || "-";
504
507
  const bindings = s.bindings.length > 0 ? s.bindings.join(", ") : "-";
505
- sections.push(`| ${s.name} | ${bindings} | ${desc} |`);
508
+ sections.push(`| ${esc(s.name)} | ${esc(bindings)} | ${esc(desc)} |`);
506
509
  }
507
510
  }
508
511
  if (hasExposes) {
@@ -511,7 +514,7 @@ function generateMarkdown(doc) {
511
514
  sections.push("| --- | --- | --- |");
512
515
  for (const e of doc.exposes) {
513
516
  const desc = e.description || "-";
514
- sections.push(`| ${e.name} | ${e.type} | ${desc} |`);
517
+ sections.push(`| ${esc(e.name)} | ${esc(e.type)} | ${esc(desc)} |`);
515
518
  }
516
519
  }
517
520
  if (hasComposables) {
package/dist/index.mjs CHANGED
@@ -444,6 +444,9 @@ function stringifyDefault(node, source) {
444
444
  }
445
445
  //#endregion
446
446
  //#region src/markdown.ts
447
+ function esc(value) {
448
+ return value.replaceAll("|", "\\|");
449
+ }
447
450
  function generateMarkdown(doc) {
448
451
  const sections = [`# ${doc.name}`];
449
452
  if (doc.description) sections.push("", doc.description);
@@ -468,7 +471,7 @@ function generateMarkdown(doc) {
468
471
  if (p.since) desc += ` *(since ${p.since})*`;
469
472
  if (p.see) desc += ` See: ${p.see}`;
470
473
  const req = p.required ? "Yes" : "No";
471
- sections.push(`| ${p.name} | ${p.type} | ${req} | ${def} | ${desc} |`);
474
+ sections.push(`| ${esc(p.name)} | ${esc(p.type)} | ${req} | ${esc(def)} | ${esc(desc)} |`);
472
475
  if (p.example) examples.push({
473
476
  name: p.name,
474
477
  example: p.example
@@ -483,7 +486,7 @@ function generateMarkdown(doc) {
483
486
  for (const e of doc.emits) {
484
487
  const desc = e.description || "-";
485
488
  const payload = e.payload || "-";
486
- sections.push(`| ${e.name} | ${payload} | ${desc} |`);
489
+ sections.push(`| ${esc(e.name)} | ${esc(payload)} | ${esc(desc)} |`);
487
490
  }
488
491
  } else {
489
492
  sections.push("", "## Emits", "");
@@ -491,7 +494,7 @@ function generateMarkdown(doc) {
491
494
  sections.push("| --- | --- |");
492
495
  for (const e of doc.emits) {
493
496
  const desc = e.description || "-";
494
- sections.push(`| ${e.name} | ${desc} |`);
497
+ sections.push(`| ${esc(e.name)} | ${esc(desc)} |`);
495
498
  }
496
499
  }
497
500
  if (hasSlots) {
@@ -501,7 +504,7 @@ function generateMarkdown(doc) {
501
504
  for (const s of doc.slots) {
502
505
  const desc = s.description || "-";
503
506
  const bindings = s.bindings.length > 0 ? s.bindings.join(", ") : "-";
504
- sections.push(`| ${s.name} | ${bindings} | ${desc} |`);
507
+ sections.push(`| ${esc(s.name)} | ${esc(bindings)} | ${esc(desc)} |`);
505
508
  }
506
509
  }
507
510
  if (hasExposes) {
@@ -510,7 +513,7 @@ function generateMarkdown(doc) {
510
513
  sections.push("| --- | --- | --- |");
511
514
  for (const e of doc.exposes) {
512
515
  const desc = e.description || "-";
513
- sections.push(`| ${e.name} | ${e.type} | ${desc} |`);
516
+ sections.push(`| ${esc(e.name)} | ${esc(e.type)} | ${esc(desc)} |`);
514
517
  }
515
518
  }
516
519
  if (hasComposables) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compmark-vue",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Auto-generate Markdown documentation from Vue 3 SFCs",
5
5
  "license": "MIT",
6
6
  "repository": "noopurphalak/compmark-vue",