@t8/docsgen 0.3.19 → 0.3.21
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 -1
- package/dist/css/base.css +1 -1
- package/package.json +1 -1
- package/src/bin/getNav.ts +4 -1
- package/src/bin/getNpmLink.ts +7 -0
- package/src/css/base.css +1 -1
package/dist/bin.js
CHANGED
|
@@ -360,6 +360,12 @@ function getInjectedContent(ctx, page, target, mode) {
|
|
|
360
360
|
// src/bin/getNav.ts
|
|
361
361
|
import { JSDOM as JSDOM2 } from "jsdom";
|
|
362
362
|
|
|
363
|
+
// src/bin/getNpmLink.ts
|
|
364
|
+
function getNpmLink({ npm }, className) {
|
|
365
|
+
if (!npm) return "";
|
|
366
|
+
return `<a href="${npm}"${className ? ` class="${className}"` : ""} target="_blank">npm</a>`;
|
|
367
|
+
}
|
|
368
|
+
|
|
363
369
|
// src/bin/getRepoLink.ts
|
|
364
370
|
function getRepoLink({ repo }, className) {
|
|
365
371
|
if (!repo) return "";
|
|
@@ -421,11 +427,13 @@ async function getNav(ctx, navItems) {
|
|
|
421
427
|
</ul>
|
|
422
428
|
` : "";
|
|
423
429
|
let repoLink = getRepoLink(ctx);
|
|
424
|
-
|
|
430
|
+
let npmLink = getNpmLink(ctx);
|
|
431
|
+
if (repoLink || npmLink || backstory)
|
|
425
432
|
s += `
|
|
426
433
|
<p class="title">Resources</p>
|
|
427
434
|
<ul>
|
|
428
435
|
${repoLink ? `<li>${repoLink}</li>` : ""}
|
|
436
|
+
${npmLink ? `<li>${npmLink}</li>` : ""}
|
|
429
437
|
${backstory ? `<li><a href="${backstory}">Backstory</a></li>` : ""}
|
|
430
438
|
</ul>
|
|
431
439
|
`;
|
package/dist/css/base.css
CHANGED
package/package.json
CHANGED
package/src/bin/getNav.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { JSDOM } from "jsdom";
|
|
|
2
2
|
import type { Context } from "../types/Context.ts";
|
|
3
3
|
import type { NavItem } from "../types/NavItem.ts";
|
|
4
4
|
import { fetchContent } from "./fetchContent.ts";
|
|
5
|
+
import { getNpmLink } from "./getNpmLink.ts";
|
|
5
6
|
import { getRepoLink } from "./getRepoLink.ts";
|
|
6
7
|
|
|
7
8
|
export async function getNav(ctx: Context, navItems: NavItem[]) {
|
|
@@ -68,12 +69,14 @@ export async function getNav(ctx: Context, navItems: NavItem[]) {
|
|
|
68
69
|
s = s ? `<p class="title">Contents</p>\n<ul>${s}\n</ul>\n` : "";
|
|
69
70
|
|
|
70
71
|
let repoLink = getRepoLink(ctx);
|
|
72
|
+
let npmLink = getNpmLink(ctx);
|
|
71
73
|
|
|
72
|
-
if (repoLink || backstory)
|
|
74
|
+
if (repoLink || npmLink || backstory)
|
|
73
75
|
s += `
|
|
74
76
|
<p class="title">Resources</p>
|
|
75
77
|
<ul>
|
|
76
78
|
${repoLink ? `<li>${repoLink}</li>` : ""}
|
|
79
|
+
${npmLink ? `<li>${npmLink}</li>` : ""}
|
|
77
80
|
${backstory ? `<li><a href="${backstory}">Backstory</a></li>` : ""}
|
|
78
81
|
</ul>
|
|
79
82
|
`;
|