@t8/docsgen 0.4.17 → 0.4.19

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
@@ -801,15 +801,6 @@ function escapeRegExp(s) {
801
801
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
802
802
  }
803
803
 
804
- // src/bin/content/getInstallationContent.ts
805
- async function getInstallationContent(ctx) {
806
- let { name, isDevDep } = ctx;
807
- let { installation } = await getParsedContent(ctx);
808
- if (!installation || isDevDep !== void 0)
809
- installation = `npm i${isDevDep ? " -D" : ""} ${name}`;
810
- return `<code>${escapeHTML(installation)}</code>`;
811
- }
812
-
813
804
  // src/bin/content/getNav.ts
814
805
  import { JSDOM as JSDOM3 } from "jsdom";
815
806
 
@@ -896,12 +887,10 @@ ${navContent}
896
887
  // src/bin/content/getSectionContent.ts
897
888
  async function getSectionContent(ctx, index) {
898
889
  let { root, contentDir = "" } = ctx;
899
- let descriptionContent = escapeHTML(tweakTypography(ctx.description));
900
- let cssRoot = await getCSSRoot(ctx, "content");
901
890
  let { sections, nav } = await getParsedContent(ctx);
891
+ let cssRoot = await getCSSRoot(ctx, "content");
902
892
  let content = sections[index];
903
893
  let navContent = await getNav(ctx, nav);
904
- let mainTitle = await getMainTitle(ctx);
905
894
  let plainTitle = await getPlainTitle(ctx);
906
895
  return toFileContent(`
907
896
  <!DOCTYPE html>
@@ -922,12 +911,9 @@ async function getSectionContent(ctx, index) {
922
911
  <body>
923
912
  ${getInjectedContent(ctx, "section", "body", "prepend")}
924
913
  <div class="layout">
925
- <header${index === 0 ? ' class="full"' : ' class="compact"'}>
926
- <h1>${index === 0 ? mainTitle : `<a href="${root}">${plainTitle}</a>`}</h1>
927
- ${index === 0 ? ` <div class="description"><p>${descriptionContent}</p></div>` : ""}
928
- </header>
929
914
  <div class="${navContent ? "" : "no-nav "}body">
930
915
  <main>
916
+ <h1><a href="${root}">${plainTitle}</a></h1>
931
917
  ${content}
932
918
 
933
919
  <p class="pagenav">
@@ -936,22 +922,15 @@ ${content}
936
922
  ${nav[index + 1]?.id ? `<span class="next"><a href="${root}${contentDir}/${nav[index + 1]?.id}">${nav[index + 1]?.title}</a> <span class="icon">\u2192</span></span>` : `<span class="repo">${getRepoLink(ctx)}</span>`}
937
923
  </p>
938
924
  </main>
939
- <hr>
925
+ ${navContent && `<hr>
940
926
  <aside class="aux">
941
- <div class="header" hidden>
942
- <h1>${mainTitle}</h1>
943
- <div class="description">
944
- <p>${descriptionContent}</p>
945
- <p class="installation">${await getInstallationContent(ctx)}</p>
946
- </div>
947
- </div>
948
927
  ${navContent.replace(
949
928
  new RegExp(
950
929
  `(<li data-id="${escapeRegExp(nav[index]?.id)}">)<a href="[^"]+">([^<]+)</a>`
951
930
  ),
952
931
  "$1<strong>$2</strong>"
953
932
  )}
954
- </aside>
933
+ </aside>`}
955
934
  </div>
956
935
  </div>
957
936
 
@@ -80,29 +80,10 @@ aside {
80
80
  var(--aux-background-end)
81
81
  );
82
82
  border-right: 0.05em solid var(--aux-border-color);
83
- padding: var(--content-padding-y) var(--content-padding-x);
83
+ padding: 0 var(--content-padding-x);
84
84
  margin: 0;
85
85
  box-sizing: border-box;
86
86
  }
87
- aside > .header {
88
- display: block;
89
- margin: 0.5rem 0 0.25rem;
90
- }
91
- aside > .header .description p:not(.installation) {
92
- font-size: 0.9em;
93
- margin: 0.35em 0 0;
94
- }
95
- aside > .header .description p.installation {
96
- margin: 1em 0 0;
97
- }
98
- aside > .header .installation code {
99
- display: inline-block;
100
- background: transparent;
101
- border: 0.05em solid;
102
- border-radius: 0.5em;
103
- padding: 0.35em 0.75em;
104
- margin: 0;
105
- }
106
87
  aside h1 {
107
88
  font-size: 1.3rem;
108
89
  margin: 0;
@@ -113,7 +94,7 @@ aside nav {
113
94
  aside section {
114
95
  width: 100%;
115
96
  max-width: 16em;
116
- padding: 1rem 0;
97
+ padding: var(--content-padding-y) 0;
117
98
  box-sizing: border-box;
118
99
  }
119
100
  aside section + section {
@@ -179,9 +160,6 @@ aside li > strong {
179
160
  padding: 0.25rem var(--content-padding-x) 0.35rem;
180
161
  margin: 0;
181
162
  }
182
- aside > .header {
183
- display: none;
184
- }
185
163
  aside nav {
186
164
  font-size: inherit;
187
165
  }
@@ -246,6 +224,13 @@ main h1 {
246
224
  color: var(--secondary-color);
247
225
  margin: 0;
248
226
  }
227
+ main h1 a,
228
+ main h1 a:link,
229
+ main h1 a:visited,
230
+ main h1 a:hover,
231
+ main h1 a:active {
232
+ --color: var(--secondary-color);
233
+ }
249
234
  h1 .sep {
250
235
  margin: 0 0.1em;
251
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "type": "module",
@@ -9,24 +9,17 @@ import { getCSSRoot } from "./getCSSRoot.ts";
9
9
  import { getDefaultCodeStyleContent } from "./getDefaultCodeStyleContent.ts";
10
10
  import { getIconTag } from "./getIconTag.ts";
11
11
  import { getInjectedContent } from "./getInjectedContent.ts";
12
- import { getInstallationContent } from "./getInstallationContent.ts";
13
- import { getMainTitle } from "./getMainTitle.ts";
14
12
  import { getNav } from "./getNav.ts";
15
13
  import { getPlainTitle } from "./getPlainTitle.ts";
16
14
  import { toFileContent } from "./toFileContent.ts";
17
- import { tweakTypography } from "./tweakTypography.ts";
18
15
 
19
16
  export async function getSectionContent(ctx: Context, index: number) {
20
17
  let { root, contentDir = "" } = ctx;
21
- let descriptionContent = escapeHTML(tweakTypography(ctx.description));
22
-
23
- let cssRoot = await getCSSRoot(ctx, "content");
24
18
  let { sections, nav } = await getParsedContent(ctx);
19
+ let cssRoot = await getCSSRoot(ctx, "content");
25
20
 
26
21
  let content = sections[index];
27
22
  let navContent = await getNav(ctx, nav);
28
-
29
- let mainTitle = await getMainTitle(ctx);
30
23
  let plainTitle = await getPlainTitle(ctx);
31
24
 
32
25
  return toFileContent(`
@@ -48,12 +41,9 @@ export async function getSectionContent(ctx: Context, index: number) {
48
41
  <body>
49
42
  ${getInjectedContent(ctx, "section", "body", "prepend")}
50
43
  <div class="layout">
51
- <header${index === 0 ? ' class="full"' : ' class="compact"'}>
52
- <h1>${index === 0 ? mainTitle : `<a href="${root}">${plainTitle}</a>`}</h1>
53
- ${index === 0 ? ` <div class="description"><p>${descriptionContent}</p></div>` : ""}
54
- </header>
55
44
  <div class="${navContent ? "" : "no-nav "}body">
56
45
  <main>
46
+ <h1><a href="${root}">${plainTitle}</a></h1>
57
47
  ${content}
58
48
 
59
49
  <p class="pagenav">
@@ -61,22 +51,18 @@ ${content}
61
51
  ${nav[index + 1]?.id ? `<span class="next"><a href="${root}${contentDir}/${nav[index + 1]?.id}">${nav[index + 1]?.title}</a> <span class="icon">→</span></span>` : `<span class="repo">${getRepoLink(ctx)}</span>`}
62
52
  </p>
63
53
  </main>
64
- <hr>
54
+ ${
55
+ navContent &&
56
+ `<hr>
65
57
  <aside class="aux">
66
- <div class="header" hidden>
67
- <h1>${mainTitle}</h1>
68
- <div class="description">
69
- <p>${descriptionContent}</p>
70
- <p class="installation">${await getInstallationContent(ctx)}</p>
71
- </div>
72
- </div>
73
58
  ${navContent.replace(
74
59
  new RegExp(
75
60
  `(<li data-id="${escapeRegExp(nav[index]?.id)}">)<a href="[^"]+">([^<]+)</a>`,
76
61
  ),
77
62
  "$1<strong>$2</strong>",
78
63
  )}
79
- </aside>
64
+ </aside>`
65
+ }
80
66
  </div>
81
67
  </div>
82
68
 
@@ -80,29 +80,10 @@ aside {
80
80
  var(--aux-background-end)
81
81
  );
82
82
  border-right: 0.05em solid var(--aux-border-color);
83
- padding: var(--content-padding-y) var(--content-padding-x);
83
+ padding: 0 var(--content-padding-x);
84
84
  margin: 0;
85
85
  box-sizing: border-box;
86
86
  }
87
- aside > .header {
88
- display: block;
89
- margin: 0.5rem 0 0.25rem;
90
- }
91
- aside > .header .description p:not(.installation) {
92
- font-size: 0.9em;
93
- margin: 0.35em 0 0;
94
- }
95
- aside > .header .description p.installation {
96
- margin: 1em 0 0;
97
- }
98
- aside > .header .installation code {
99
- display: inline-block;
100
- background: transparent;
101
- border: 0.05em solid;
102
- border-radius: 0.5em;
103
- padding: 0.35em 0.75em;
104
- margin: 0;
105
- }
106
87
  aside h1 {
107
88
  font-size: 1.3rem;
108
89
  margin: 0;
@@ -113,7 +94,7 @@ aside nav {
113
94
  aside section {
114
95
  width: 100%;
115
96
  max-width: 16em;
116
- padding: 1rem 0;
97
+ padding: var(--content-padding-y) 0;
117
98
  box-sizing: border-box;
118
99
  }
119
100
  aside section + section {
@@ -179,9 +160,6 @@ aside li > strong {
179
160
  padding: 0.25rem var(--content-padding-x) 0.35rem;
180
161
  margin: 0;
181
162
  }
182
- aside > .header {
183
- display: none;
184
- }
185
163
  aside nav {
186
164
  font-size: inherit;
187
165
  }
@@ -246,6 +224,13 @@ main h1 {
246
224
  color: var(--secondary-color);
247
225
  margin: 0;
248
226
  }
227
+ main h1 a,
228
+ main h1 a:link,
229
+ main h1 a:visited,
230
+ main h1 a:hover,
231
+ main h1 a:active {
232
+ --color: var(--secondary-color);
233
+ }
249
234
  h1 .sep {
250
235
  margin: 0 0.1em;
251
236
  }