@t8/docsgen 0.2.33 → 0.2.35
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 +9 -3
- package/dist/css/index.css +11 -5
- package/package.json +1 -1
- package/src/bin/getConfig.ts +1 -1
- package/src/bin/setContent.ts +3 -0
- package/src/bin/stripHTML.ts +7 -2
- package/src/css/index.css +11 -5
package/dist/bin.js
CHANGED
|
@@ -141,8 +141,11 @@ function getLocation(ctx, path, preferredLocation) {
|
|
|
141
141
|
var import_jsdom = require("jsdom");
|
|
142
142
|
function stripHTML(content, replaceNbsp = false) {
|
|
143
143
|
try {
|
|
144
|
-
let
|
|
145
|
-
|
|
144
|
+
let t = content.replaceAll("<sup>", " (").replaceAll("</sup>", ")");
|
|
145
|
+
let s = new import_jsdom.JSDOM(t).window.document.body.textContent;
|
|
146
|
+
if (replaceNbsp) s = s.replaceAll("\xA0", " ");
|
|
147
|
+
s = s.replace(/ +/, " ");
|
|
148
|
+
return s;
|
|
146
149
|
} catch {
|
|
147
150
|
}
|
|
148
151
|
}
|
|
@@ -188,7 +191,7 @@ async function addMetadata(config2) {
|
|
|
188
191
|
}
|
|
189
192
|
function deriveProps(config2) {
|
|
190
193
|
let { dir, assetsDir, root, title, htmlTitle } = config2;
|
|
191
|
-
if (htmlTitle && !title) title = stripHTML(htmlTitle);
|
|
194
|
+
if (htmlTitle && !title) title = stripHTML(htmlTitle, true);
|
|
192
195
|
if (dir && !root) root = `/${dir}/`;
|
|
193
196
|
if (!root?.endsWith("/")) root = `${root ?? ""}/`;
|
|
194
197
|
if (dir && assetsDir?.includes("{{dir}}"))
|
|
@@ -876,6 +879,9 @@ ${intro || features || note ? `
|
|
|
876
879
|
${intro ? `<div class="intro">${intro}</div>` : ""}
|
|
877
880
|
${features ? `<div class="features">${features}</div>` : ""}
|
|
878
881
|
${note ? `<div class="note">${note}</div>` : ""}
|
|
882
|
+
<p class="pagenav">
|
|
883
|
+
<span class="next"><a href="/start">To the docs</a> <span class="icon">\u2192</span></span>
|
|
884
|
+
</p>
|
|
879
885
|
</div>
|
|
880
886
|
</section>
|
|
881
887
|
` : ""}
|
package/dist/css/index.css
CHANGED
|
@@ -50,13 +50,16 @@ h1 {
|
|
|
50
50
|
font-size: 2.25em;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
h1 a,
|
|
54
|
-
h1 a:link,
|
|
55
|
-
h1 a:hover,
|
|
56
|
-
h1 a:visited,
|
|
57
|
-
h1 a:active {
|
|
53
|
+
h1 > a,
|
|
54
|
+
h1 > a:link,
|
|
55
|
+
h1 > a:hover,
|
|
56
|
+
h1 > a:visited,
|
|
57
|
+
h1 > a:active {
|
|
58
58
|
border-bottom: none;
|
|
59
59
|
}
|
|
60
|
+
h1 sup {
|
|
61
|
+
font-size: 0.5em;
|
|
62
|
+
}
|
|
60
63
|
header {
|
|
61
64
|
display: block;
|
|
62
65
|
text-align: center;
|
|
@@ -238,6 +241,9 @@ section.intro .section-content {
|
|
|
238
241
|
padding: 0;
|
|
239
242
|
}
|
|
240
243
|
}
|
|
244
|
+
.pagenav {
|
|
245
|
+
text-align: right;
|
|
246
|
+
}
|
|
241
247
|
p.installation {
|
|
242
248
|
margin: 0;
|
|
243
249
|
}
|
package/package.json
CHANGED
package/src/bin/getConfig.ts
CHANGED
|
@@ -24,7 +24,7 @@ async function addMetadata(config: EntryConfig) {
|
|
|
24
24
|
function deriveProps(config: EntryConfig) {
|
|
25
25
|
let { dir, assetsDir, root, title, htmlTitle } = config;
|
|
26
26
|
|
|
27
|
-
if (htmlTitle && !title) title = stripHTML(htmlTitle);
|
|
27
|
+
if (htmlTitle && !title) title = stripHTML(htmlTitle, true);
|
|
28
28
|
if (dir && !root) root = `/${dir}/`;
|
|
29
29
|
if (!root?.endsWith("/")) root = `${root ?? ""}/`;
|
|
30
30
|
|
package/src/bin/setContent.ts
CHANGED
|
@@ -250,6 +250,9 @@ ${
|
|
|
250
250
|
${intro ? `<div class="intro">${intro}</div>` : ""}
|
|
251
251
|
${features ? `<div class="features">${features}</div>` : ""}
|
|
252
252
|
${note ? `<div class="note">${note}</div>` : ""}
|
|
253
|
+
<p class="pagenav">
|
|
254
|
+
<span class="next"><a href="/start">To the docs</a> <span class="icon">→</span></span>
|
|
255
|
+
</p>
|
|
253
256
|
</div>
|
|
254
257
|
</section>
|
|
255
258
|
`
|
package/src/bin/stripHTML.ts
CHANGED
|
@@ -2,8 +2,13 @@ import { JSDOM } from "jsdom";
|
|
|
2
2
|
|
|
3
3
|
export function stripHTML(content: string, replaceNbsp = false) {
|
|
4
4
|
try {
|
|
5
|
-
let
|
|
5
|
+
let t = content.replaceAll("<sup>", " (").replaceAll("</sup>", ")");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
let s = new JSDOM(t).window.document.body.textContent;
|
|
8
|
+
|
|
9
|
+
if (replaceNbsp) s = s.replaceAll("\xa0", " ");
|
|
10
|
+
s = s.replace(/ +/, " ");
|
|
11
|
+
|
|
12
|
+
return s;
|
|
8
13
|
} catch {}
|
|
9
14
|
}
|
package/src/css/index.css
CHANGED
|
@@ -50,13 +50,16 @@ h1 {
|
|
|
50
50
|
font-size: 2.25em;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
h1 a,
|
|
54
|
-
h1 a:link,
|
|
55
|
-
h1 a:hover,
|
|
56
|
-
h1 a:visited,
|
|
57
|
-
h1 a:active {
|
|
53
|
+
h1 > a,
|
|
54
|
+
h1 > a:link,
|
|
55
|
+
h1 > a:hover,
|
|
56
|
+
h1 > a:visited,
|
|
57
|
+
h1 > a:active {
|
|
58
58
|
border-bottom: none;
|
|
59
59
|
}
|
|
60
|
+
h1 sup {
|
|
61
|
+
font-size: 0.5em;
|
|
62
|
+
}
|
|
60
63
|
header {
|
|
61
64
|
display: block;
|
|
62
65
|
text-align: center;
|
|
@@ -238,6 +241,9 @@ section.intro .section-content {
|
|
|
238
241
|
padding: 0;
|
|
239
242
|
}
|
|
240
243
|
}
|
|
244
|
+
.pagenav {
|
|
245
|
+
text-align: right;
|
|
246
|
+
}
|
|
241
247
|
p.installation {
|
|
242
248
|
margin: 0;
|
|
243
249
|
}
|