@t8/docsgen 0.2.9 → 0.2.11

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
@@ -688,6 +688,9 @@ function getDefaultCodeStyleContent(cssRoot) {
688
688
  <script>hljs.highlightAll()</script>
689
689
  `.trim();
690
690
  }
691
+ function tweakTypography(s = "") {
692
+ 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");
693
+ }
691
694
  async function setContent(ctx) {
692
695
  let {
693
696
  dir = "",
@@ -768,6 +771,7 @@ ${getInjectedContent(ctx, "redirect", "body")}
768
771
  sections,
769
772
  nav
770
773
  } = await getParsedContent(ctx);
774
+ let descriptionContent = tweakTypography(description) || (escapedPackageDescription ? `<p><em>${tweakTypography(escapedPackageDescription)}</em><p>` : "");
771
775
  let navContent = await getNav(ctx, nav);
772
776
  let dirs = [contentDir];
773
777
  await Promise.all(
@@ -857,7 +861,7 @@ ${getInjectedContent(ctx, "section", "body")}
857
861
  <div class="section-content">
858
862
  <h1>${getTitle(ctx, { cover: true })}</h1>
859
863
  <div class="description">
860
- ${description || (escapedPackageDescription ? `<p><em>${escapedPackageDescription}</em><p>` : "")}
864
+ ${descriptionContent}
861
865
  ${descriptionNote}
862
866
  </div>
863
867
  <p class="actions">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "bin": {
@@ -27,6 +27,12 @@ function getDefaultCodeStyleContent(cssRoot: string) {
27
27
  `.trim();
28
28
  }
29
29
 
30
+ function tweakTypography(s = "") {
31
+ return s
32
+ .replace(/\b(for|in|on|at|with|a|an|the)\s+/gi, "$1\xa0")
33
+ .replace(/\b(React)\s+(apps?)\b/gi, "$1\xa0$2");
34
+ }
35
+
30
36
  export async function setContent(ctx: Context) {
31
37
  let {
32
38
  dir = "",
@@ -129,6 +135,12 @@ ${getInjectedContent(ctx, "redirect", "body")}
129
135
  nav,
130
136
  } = await getParsedContent(ctx);
131
137
 
138
+ let descriptionContent =
139
+ tweakTypography(description) ||
140
+ (escapedPackageDescription
141
+ ? `<p><em>${tweakTypography(escapedPackageDescription)}</em><p>`
142
+ : "");
143
+
132
144
  let navContent = await getNav(ctx, nav);
133
145
  let dirs = [contentDir];
134
146
 
@@ -226,7 +238,7 @@ ${getInjectedContent(ctx, "section", "body")}
226
238
  <div class="section-content">
227
239
  <h1>${getTitle(ctx, { cover: true })}</h1>
228
240
  <div class="description">
229
- ${description || (escapedPackageDescription ? `<p><em>${escapedPackageDescription}</em><p>` : "")}
241
+ ${descriptionContent}
230
242
  ${descriptionNote}
231
243
  </div>
232
244
  <p class="actions">