@t8/docsgen 0.3.20 → 0.3.22

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
@@ -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
- if (repoLink || backstory)
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
  `;
@@ -675,7 +683,7 @@ var __filename = fileURLToPath(import.meta.url);
675
683
  var __dirname = dirname(__filename);
676
684
  function getDefaultCodeStyleContent(cssRoot) {
677
685
  return `
678
- <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/dark.min.css" media="(prefers-color-scheme: light)">
686
+ <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css" media="(prefers-color-scheme: light)">
679
687
  <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/base16/material.min.css" media="(prefers-color-scheme: dark)">
680
688
  <link rel="stylesheet" href="${cssRoot}/code.css">
681
689
  <script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "type": "module",
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
  `;
@@ -0,0 +1,7 @@
1
+ import type { Context } from "../types/Context.ts";
2
+
3
+ export function getNpmLink({ npm }: Context, className?: string) {
4
+ if (!npm) return "";
5
+
6
+ return `<a href="${npm}"${className ? ` class="${className}"` : ""} target="_blank">npm</a>`;
7
+ }
@@ -23,7 +23,7 @@ const __dirname = dirname(__filename);
23
23
 
24
24
  function getDefaultCodeStyleContent(cssRoot: string) {
25
25
  return `
26
- <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/dark.min.css" media="(prefers-color-scheme: light)">
26
+ <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css" media="(prefers-color-scheme: light)">
27
27
  <link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/base16/material.min.css" media="(prefers-color-scheme: dark)">
28
28
  <link rel="stylesheet" href="${cssRoot}/code.css">
29
29
  <script src="https://unpkg.com/@highlightjs/cdn-assets@11.11.1/highlight.min.js"></script>