@t8/docsgen 0.4.18 → 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,11 +911,9 @@ async function getSectionContent(ctx, index) {
922
911
  <body>
923
912
  ${getInjectedContent(ctx, "section", "body", "prepend")}
924
913
  <div class="layout">
925
- <header class="compact">
926
- <h1><a href="${root}">${plainTitle}</a></h1>
927
- </header>
928
914
  <div class="${navContent ? "" : "no-nav "}body">
929
915
  <main>
916
+ <h1><a href="${root}">${plainTitle}</a></h1>
930
917
  ${content}
931
918
 
932
919
  <p class="pagenav">
@@ -935,22 +922,15 @@ ${content}
935
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>`}
936
923
  </p>
937
924
  </main>
938
- <hr>
925
+ ${navContent && `<hr>
939
926
  <aside class="aux">
940
- <div class="header" hidden>
941
- <h1>${mainTitle}</h1>
942
- <div class="description">
943
- <p>${descriptionContent}</p>
944
- <p class="installation">${await getInstallationContent(ctx)}</p>
945
- </div>
946
- </div>
947
927
  ${navContent.replace(
948
928
  new RegExp(
949
929
  `(<li data-id="${escapeRegExp(nav[index]?.id)}">)<a href="[^"]+">([^<]+)</a>`
950
930
  ),
951
931
  "$1<strong>$2</strong>"
952
932
  )}
953
- </aside>
933
+ </aside>`}
954
934
  </div>
955
935
  </div>
956
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.18",
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,11 +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 class="compact">
52
- <h1><a href="${root}">${plainTitle}</a></h1>
53
- </header>
54
44
  <div class="${navContent ? "" : "no-nav "}body">
55
45
  <main>
46
+ <h1><a href="${root}">${plainTitle}</a></h1>
56
47
  ${content}
57
48
 
58
49
  <p class="pagenav">
@@ -60,22 +51,18 @@ ${content}
60
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>`}
61
52
  </p>
62
53
  </main>
63
- <hr>
54
+ ${
55
+ navContent &&
56
+ `<hr>
64
57
  <aside class="aux">
65
- <div class="header" hidden>
66
- <h1>${mainTitle}</h1>
67
- <div class="description">
68
- <p>${descriptionContent}</p>
69
- <p class="installation">${await getInstallationContent(ctx)}</p>
70
- </div>
71
- </div>
72
58
  ${navContent.replace(
73
59
  new RegExp(
74
60
  `(<li data-id="${escapeRegExp(nav[index]?.id)}">)<a href="[^"]+">([^<]+)</a>`,
75
61
  ),
76
62
  "$1<strong>$2</strong>",
77
63
  )}
78
- </aside>
64
+ </aside>`
65
+ }
79
66
  </div>
80
67
  </div>
81
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
  }