@t8/docsgen 0.2.30 → 0.2.32

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/bin.js CHANGED
@@ -590,7 +590,6 @@ async function getParsedContent(ctx) {
590
590
  let badges = "";
591
591
  let title = "";
592
592
  let description = [];
593
- let descriptionNote = [];
594
593
  let intro = [];
595
594
  let features = [];
596
595
  let note = [];
@@ -616,22 +615,31 @@ async function getParsedContent(ctx) {
616
615
  }
617
616
  }
618
617
  let { outerHTML } = element;
619
- if (indexComplete) section.push(outerHTML);
620
- else if (!hasFeatures) {
621
- if (element.matches("ul")) {
622
- hasFeatures = true;
623
- features.push(outerHTML);
624
- } else {
625
- let installationCode = getInstallationCode(element);
626
- if (installationCode) installation = installationCode;
627
- else if (description.length === 0) description.push(outerHTML);
628
- else intro.push(outerHTML);
629
- }
630
- } else {
631
- let installationCode = getInstallationCode(element);
632
- if (installationCode) installation = installationCode;
618
+ if (indexComplete) {
619
+ section.push(outerHTML);
620
+ continue;
621
+ }
622
+ if (hasFeatures) {
623
+ let installationCode2 = getInstallationCode(element);
624
+ if (installationCode2) installation = installationCode2;
633
625
  else note.push(outerHTML);
626
+ continue;
627
+ }
628
+ if (element.matches("ul")) {
629
+ hasFeatures = true;
630
+ features.push(outerHTML);
631
+ continue;
632
+ }
633
+ let installationCode = getInstallationCode(element);
634
+ if (installationCode) {
635
+ installation = installationCode;
636
+ continue;
634
637
  }
638
+ if (element.matches("p") && description.length === 0) {
639
+ description.push(outerHTML);
640
+ continue;
641
+ }
642
+ intro.push(outerHTML);
635
643
  }
636
644
  if (section.length !== 0) sections.push(joinLines(section));
637
645
  let postprocess = getSectionPostprocess({
@@ -643,10 +651,6 @@ async function getParsedContent(ctx) {
643
651
  description = [];
644
652
  }
645
653
  if (intro.at(-1) === "<hr>") intro.pop();
646
- if (intro.length === 1) {
647
- descriptionNote = intro;
648
- intro = [];
649
- }
650
654
  for (let i = 0; i < intro.length; i++) {
651
655
  if (intro[i].includes("<br>") && intro[i].startsWith("<p>") && intro[i].endsWith("</p>")) {
652
656
  let s = intro[i].slice(3, -4).replace(/<br>(\r?\n)?(\s*)/g, '</span><br>$1$2<span class="li">');
@@ -658,7 +662,6 @@ async function getParsedContent(ctx) {
658
662
  // postprocessBadges(joinLines(badges)),
659
663
  title,
660
664
  description: joinLines(description),
661
- descriptionNote: joinLines(descriptionNote),
662
665
  intro: joinLines(intro),
663
666
  features: joinLines(features),
664
667
  note: joinLines(note),
@@ -693,7 +696,7 @@ function getDefaultCodeStyleContent(cssRoot) {
693
696
  `.trim();
694
697
  }
695
698
  function tweakTypography(s = "") {
696
- return s.replace(/\b(for|in|on|at|with|a|an|the)\s+/gi, "$1\xA0").replace(/\b(React)\s+(apps?)\b/gi, "$1\xA0$2");
699
+ return s.replace(/\b(for|in|on|at|to|with|a|an|the|its)\s+/gi, "$1\xA0").replace(/\b(React)\s+(apps?)\b/gi, "$1\xA0$2");
697
700
  }
698
701
  async function setContent(ctx) {
699
702
  let {
@@ -765,17 +768,8 @@ ${getInjectedContent(ctx, "redirect", "body")}
765
768
  );
766
769
  return;
767
770
  }
768
- let {
769
- description,
770
- descriptionNote,
771
- intro,
772
- features,
773
- note,
774
- installation,
775
- sections,
776
- nav
777
- } = await getParsedContent(ctx);
778
- let descriptionContent = tweakTypography(description) || (escapedPackageDescription ? `<p><em>${tweakTypography(escapedPackageDescription)}</em><p>` : "");
771
+ let { description, intro, features, note, installation, sections, nav } = await getParsedContent(ctx);
772
+ let descriptionContent = tweakTypography(description) || (escapedPackageDescription ? `<p>${tweakTypography(escapedPackageDescription)}<p>` : "");
779
773
  let navContent = await getNav(ctx, nav);
780
774
  let dirs = [contentDir];
781
775
  await Promise.all(
@@ -866,7 +860,6 @@ ${getInjectedContent(ctx, "section", "body")}
866
860
  <h1>${getTitle(ctx, { cover: true })}</h1>
867
861
  <div class="description">
868
862
  ${descriptionContent}
869
- ${descriptionNote}
870
863
  </div>
871
864
  <p class="actions">
872
865
  <a href="${root}start" class="primary">Docs</a>
package/dist/css/base.css CHANGED
@@ -36,6 +36,9 @@
36
36
  --overlay-border-color: hsl(from var(--b1) h s 60% / 0.7);
37
37
 
38
38
  font: normal 100% / 1.45 sans-serif;
39
+ font-family:
40
+ -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",
41
+ "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
39
42
  }
40
43
  html {
41
44
  color: var(--c0);
@@ -64,7 +64,6 @@ header {
64
64
  padding: 0 var(--content-padding-x);
65
65
  }
66
66
  .description {
67
- font-size: 1.15em;
68
67
  margin: 0;
69
68
  }
70
69
  .description p {
@@ -73,6 +72,9 @@ header {
73
72
  .description p + p {
74
73
  margin-top: 0.75em;
75
74
  }
75
+ .description em {
76
+ font-style: normal;
77
+ }
76
78
  .actions {
77
79
  --r: 1em;
78
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "bin": {
@@ -27,7 +27,6 @@ export async function getParsedContent(ctx: Context) {
27
27
  let badges = "";
28
28
  let title = "";
29
29
  let description: string[] = [];
30
- let descriptionNote: string[] = [];
31
30
  let intro: string[] = [];
32
31
  let features: string[] = [];
33
32
  let note: string[] = [];
@@ -61,24 +60,39 @@ export async function getParsedContent(ctx: Context) {
61
60
 
62
61
  let { outerHTML } = element;
63
62
 
64
- if (indexComplete) section.push(outerHTML);
65
- else if (!hasFeatures) {
66
- if (element.matches("ul")) {
67
- hasFeatures = true;
68
- features.push(outerHTML);
69
- } else {
70
- let installationCode = getInstallationCode(element);
71
-
72
- if (installationCode) installation = installationCode;
73
- else if (description.length === 0) description.push(outerHTML);
74
- else intro.push(outerHTML);
75
- }
76
- } else {
63
+ if (indexComplete) {
64
+ section.push(outerHTML);
65
+ continue;
66
+ }
67
+
68
+ if (hasFeatures) {
77
69
  let installationCode = getInstallationCode(element);
78
70
 
79
71
  if (installationCode) installation = installationCode;
80
72
  else note.push(outerHTML);
73
+
74
+ continue;
81
75
  }
76
+
77
+ if (element.matches("ul")) {
78
+ hasFeatures = true;
79
+ features.push(outerHTML);
80
+ continue;
81
+ }
82
+
83
+ let installationCode = getInstallationCode(element);
84
+
85
+ if (installationCode) {
86
+ installation = installationCode;
87
+ continue;
88
+ }
89
+
90
+ if (element.matches("p") && description.length === 0) {
91
+ description.push(outerHTML);
92
+ continue;
93
+ }
94
+
95
+ intro.push(outerHTML);
82
96
  }
83
97
 
84
98
  if (section.length !== 0) sections.push(joinLines(section));
@@ -99,11 +113,6 @@ export async function getParsedContent(ctx: Context) {
99
113
 
100
114
  if (intro.at(-1) === "<hr>") intro.pop();
101
115
 
102
- if (intro.length === 1) {
103
- descriptionNote = intro;
104
- intro = [];
105
- }
106
-
107
116
  for (let i = 0; i < intro.length; i++) {
108
117
  if (
109
118
  intro[i].includes("<br>") &&
@@ -122,7 +131,6 @@ export async function getParsedContent(ctx: Context) {
122
131
  badges, // postprocessBadges(joinLines(badges)),
123
132
  title,
124
133
  description: joinLines(description),
125
- descriptionNote: joinLines(descriptionNote),
126
134
  intro: joinLines(intro),
127
135
  features: joinLines(features),
128
136
  note: joinLines(note),
@@ -30,7 +30,7 @@ function getDefaultCodeStyleContent(cssRoot: string) {
30
30
 
31
31
  function tweakTypography(s = "") {
32
32
  return s
33
- .replace(/\b(for|in|on|at|with|a|an|the)\s+/gi, "$1\xa0")
33
+ .replace(/\b(for|in|on|at|to|with|a|an|the|its)\s+/gi, "$1\xa0")
34
34
  .replace(/\b(React)\s+(apps?)\b/gi, "$1\xa0$2");
35
35
  }
36
36
 
@@ -125,21 +125,13 @@ ${getInjectedContent(ctx, "redirect", "body")}
125
125
  return;
126
126
  }
127
127
 
128
- let {
129
- description,
130
- descriptionNote,
131
- intro,
132
- features,
133
- note,
134
- installation,
135
- sections,
136
- nav,
137
- } = await getParsedContent(ctx);
128
+ let { description, intro, features, note, installation, sections, nav } =
129
+ await getParsedContent(ctx);
138
130
 
139
131
  let descriptionContent =
140
132
  tweakTypography(description) ||
141
133
  (escapedPackageDescription
142
- ? `<p><em>${tweakTypography(escapedPackageDescription)}</em><p>`
134
+ ? `<p>${tweakTypography(escapedPackageDescription)}<p>`
143
135
  : "");
144
136
 
145
137
  let navContent = await getNav(ctx, nav);
@@ -240,7 +232,6 @@ ${getInjectedContent(ctx, "section", "body")}
240
232
  <h1>${getTitle(ctx, { cover: true })}</h1>
241
233
  <div class="description">
242
234
  ${descriptionContent}
243
- ${descriptionNote}
244
235
  </div>
245
236
  <p class="actions">
246
237
  <a href="${root}start" class="primary">Docs</a>
package/src/css/base.css CHANGED
@@ -36,6 +36,9 @@
36
36
  --overlay-border-color: hsl(from var(--b1) h s 60% / 0.7);
37
37
 
38
38
  font: normal 100% / 1.45 sans-serif;
39
+ font-family:
40
+ -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",
41
+ "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
39
42
  }
40
43
  html {
41
44
  color: var(--c0);
package/src/css/index.css CHANGED
@@ -64,7 +64,6 @@ header {
64
64
  padding: 0 var(--content-padding-x);
65
65
  }
66
66
  .description {
67
- font-size: 1.15em;
68
67
  margin: 0;
69
68
  }
70
69
  .description p {
@@ -73,6 +72,9 @@ header {
73
72
  .description p + p {
74
73
  margin-top: 0.75em;
75
74
  }
75
+ .description em {
76
+ font-style: normal;
77
+ }
76
78
  .actions {
77
79
  --r: 1em;
78
80