@t8/docsgen 0.2.43 → 0.2.45
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 +24 -31
- package/package.json +1 -1
- package/schema.json +1 -1
- package/src/bin/setContent.ts +24 -13
- package/src/bin/stripHTML.ts +2 -0
- package/src/types/EntryConfig.ts +0 -2
- package/src/bin/getTitle.ts +0 -48
package/dist/bin.js
CHANGED
|
@@ -117,6 +117,7 @@ function getLocation(ctx, path, preferredLocation) {
|
|
|
117
117
|
// src/bin/stripHTML.ts
|
|
118
118
|
import { JSDOM } from "jsdom";
|
|
119
119
|
function stripHTML(content, replaceNbsp = false) {
|
|
120
|
+
if (!content) return "";
|
|
120
121
|
try {
|
|
121
122
|
let t = content.replaceAll("<sup>", " (").replaceAll("</sup>", ")");
|
|
122
123
|
let s = new JSDOM(t).window.document.body.textContent;
|
|
@@ -411,26 +412,6 @@ ${navContent}
|
|
|
411
412
|
</nav>`;
|
|
412
413
|
}
|
|
413
414
|
|
|
414
|
-
// src/bin/getTitle.ts
|
|
415
|
-
function getTitle(ctx, { cover, originalContent, withPackageURL } = {}) {
|
|
416
|
-
let { root, name, title: packageTitle, htmlTitle, scope } = ctx;
|
|
417
|
-
if (originalContent && ![name, packageTitle].includes(originalContent.trim()))
|
|
418
|
-
return originalContent;
|
|
419
|
-
if (cover && htmlTitle) return htmlTitle;
|
|
420
|
-
if (packageTitle) {
|
|
421
|
-
let escapedTitle = escapeHTML(packageTitle);
|
|
422
|
-
return withPackageURL ? `<a href="${root}" class="name">${escapedTitle}</a>` : `<span class="name">${escapedTitle}</span>`;
|
|
423
|
-
}
|
|
424
|
-
let scopeMatches = name?.match(/^(@[^/]+)\/?(.*)/);
|
|
425
|
-
if (!scope || !scopeMatches) {
|
|
426
|
-
let escapedName = escapeHTML(name);
|
|
427
|
-
return withPackageURL ? `<a href="${root}" class="name">${escapedName}</a>` : `<span class="name">${escapedName}</span>`;
|
|
428
|
-
}
|
|
429
|
-
let title = `<a href="${scope}" class="scope">${scopeMatches[1]}</a><span class="sep">/</span>`;
|
|
430
|
-
title += withPackageURL ? `<a href="${root}" class="name">${scopeMatches[2]}</a>` : `<span class="name">${scopeMatches[2]}</span>`;
|
|
431
|
-
return title;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
415
|
// src/bin/parsing/getParsedContent.ts
|
|
435
416
|
import { JSDOM as JSDOM3 } from "jsdom";
|
|
436
417
|
import Markdown from "markdown-it";
|
|
@@ -692,13 +673,12 @@ async function setContent(ctx) {
|
|
|
692
673
|
contentDir = "",
|
|
693
674
|
name,
|
|
694
675
|
title,
|
|
676
|
+
htmlTitle,
|
|
695
677
|
description: packageDescription,
|
|
696
678
|
backstory,
|
|
697
679
|
redirect
|
|
698
680
|
} = ctx;
|
|
699
681
|
let counterContent = getCounterContent(ctx);
|
|
700
|
-
let escapedName = escapeHTML(name);
|
|
701
|
-
let escapedTitle = title ? escapeHTML(title) : escapedName;
|
|
702
682
|
let escapedPackageDescription = escapeHTML(packageDescription);
|
|
703
683
|
let rootAttrs = "";
|
|
704
684
|
let cssRoot = {
|
|
@@ -751,7 +731,20 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
751
731
|
);
|
|
752
732
|
return;
|
|
753
733
|
}
|
|
754
|
-
let {
|
|
734
|
+
let {
|
|
735
|
+
title: parsedTitle,
|
|
736
|
+
description,
|
|
737
|
+
intro,
|
|
738
|
+
features,
|
|
739
|
+
note,
|
|
740
|
+
installation,
|
|
741
|
+
sections,
|
|
742
|
+
nav
|
|
743
|
+
} = await getParsedContent(ctx);
|
|
744
|
+
let plainTitle = escapeHTML(
|
|
745
|
+
title || stripHTML(htmlTitle || parsedTitle, true) || name
|
|
746
|
+
);
|
|
747
|
+
let coverTitle = htmlTitle || parsedTitle || plainTitle;
|
|
755
748
|
let descriptionContent = tweakTypography(description) || (escapedPackageDescription ? `<p>${tweakTypography(escapedPackageDescription)}<p>` : "");
|
|
756
749
|
let navContent = await getNav(ctx, nav);
|
|
757
750
|
let dirs = [contentDir];
|
|
@@ -775,8 +768,8 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
775
768
|
<head>
|
|
776
769
|
<meta charset="utf-8">
|
|
777
770
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
778
|
-
<meta name="description" content="${
|
|
779
|
-
<title>${escapeHTML(stripHTML(nav[i]?.title, true))} | ${
|
|
771
|
+
<meta name="description" content="${plainTitle}: ${escapeHTML(stripHTML(nav[i]?.title, true))}">
|
|
772
|
+
<title>${escapeHTML(stripHTML(nav[i]?.title, true))} | ${plainTitle}</title>
|
|
780
773
|
<link rel="stylesheet" href="${cssRoot.content}/base.css">
|
|
781
774
|
<link rel="stylesheet" href="${cssRoot.content}/section.css">
|
|
782
775
|
${iconTag}
|
|
@@ -788,7 +781,7 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
788
781
|
<div class="layout">
|
|
789
782
|
<div class="${navContent ? "" : "no-nav "}body">
|
|
790
783
|
<main>
|
|
791
|
-
<h1
|
|
784
|
+
<h1><a href="${root}">${coverTitle}</a></h1>
|
|
792
785
|
${content}
|
|
793
786
|
|
|
794
787
|
<p class="pagenav">
|
|
@@ -826,8 +819,8 @@ ${getInjectedContent(ctx, "section", "body")}
|
|
|
826
819
|
<head>
|
|
827
820
|
<meta charset="utf-8">
|
|
828
821
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
829
|
-
<meta name="description" content="${
|
|
830
|
-
<title>${
|
|
822
|
+
<meta name="description" content="${plainTitle}${escapedPackageDescription ? `: ${escapedPackageDescription}` : ""}">
|
|
823
|
+
<title>${plainTitle}${escapedPackageDescription ? ` | ${escapedPackageDescription}` : ""}</title>
|
|
831
824
|
<link rel="stylesheet" href="${cssRoot.index}/base.css">
|
|
832
825
|
<link rel="stylesheet" href="${cssRoot.index}/index.css">
|
|
833
826
|
${iconTag}
|
|
@@ -840,7 +833,7 @@ ${getInjectedContent(ctx, "section", "body")}
|
|
|
840
833
|
<main>
|
|
841
834
|
<section class="b1 intro-title">
|
|
842
835
|
<div class="section-content">
|
|
843
|
-
<h1>${
|
|
836
|
+
<h1>${coverTitle}</h1>
|
|
844
837
|
<div class="description">
|
|
845
838
|
${descriptionContent}
|
|
846
839
|
</div>
|
|
@@ -884,7 +877,7 @@ ${getInjectedContent(ctx, "index", "body")}
|
|
|
884
877
|
<meta charset="utf-8">
|
|
885
878
|
<meta name="viewport" content="width=device-width">
|
|
886
879
|
<meta http-equiv="refresh" content="0; URL=${root}${contentDir}/${nav[0]?.id}">
|
|
887
|
-
<title>${
|
|
880
|
+
<title>${plainTitle}</title>
|
|
888
881
|
<link rel="stylesheet" href="${cssRoot.index}/base.css">
|
|
889
882
|
${iconTag}
|
|
890
883
|
<script>window.location.replace("${root}${contentDir}/${nav[0]?.id}");</script>
|
|
@@ -892,7 +885,7 @@ ${getInjectedContent(ctx, "index", "body")}
|
|
|
892
885
|
</head>
|
|
893
886
|
<body>
|
|
894
887
|
<div class="layout">
|
|
895
|
-
<h1>${
|
|
888
|
+
<h1>${plainTitle}</h1>
|
|
896
889
|
</div>
|
|
897
890
|
|
|
898
891
|
${counterContent}
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$ref":"#/definitions/Config","$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Config":{"additionalProperties":false,"properties":{"$schema":{"type":"string"},"append":{"$ref":"#/definitions/ContentInjectionMap%3C(%22head%22%7C%22body%22%7C%22%3Ahas-code%22)%3E"},"assetsDir":{"description":"Directory path for assets, relative to `dir`. If not provided, the assets will be added via the package URLs.","type":"string"},"backstory":{"description":"Backstory link URL to be added to the front page.","type":"string"},"baseColor":{"type":"string"},"cname":{"description":"Content of the './CNAME' file.","type":"string"},"contentDir":{"description":"Generated section content directory.","type":"string"},"description":{"type":"string"},"dir":{"type":"string"},"entries":{"items":{"$ref":"#/definitions/EntryConfig"},"type":"array"},"favicon":{"description":"Favicon URL.","type":"string"},"faviconType":{"type":"string"},"htmlTitle":{"type":"string"},"id":{"type":"string"},"jsorg":{"description":"As a boolean, it means whether to add the '<package_name>.js.org' domain to the './CNAME' file.\n\nAs a string, it sets the '<jsorg_value>.js.org' domain to the './CNAME' file.","type":["boolean","string"]},"linkColor":{"type":"string"},"linkMap":{"additionalProperties":{"anyOf":[{"type":"string"},{"not":{}}]},"description":"Link substitution map.","type":"object"},"mainBranch":{"type":"string"},"name":{"type":"string"},"nav":{"description":"URL of an HTML file inserted into the navigation bar.","type":"string"},"npm":{"type":"string"},"redirect":{"description":"Redirection URL.","type":"string"},"remove":{"description":"Whether to remove the GitHub Pages branch and quit.","type":"boolean"},"repo":{"type":"string"},"root":{"description":"Main page root path.","type":"string"},"
|
|
1
|
+
{"$ref":"#/definitions/Config","$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Config":{"additionalProperties":false,"properties":{"$schema":{"type":"string"},"append":{"$ref":"#/definitions/ContentInjectionMap%3C(%22head%22%7C%22body%22%7C%22%3Ahas-code%22)%3E"},"assetsDir":{"description":"Directory path for assets, relative to `dir`. If not provided, the assets will be added via the package URLs.","type":"string"},"backstory":{"description":"Backstory link URL to be added to the front page.","type":"string"},"baseColor":{"type":"string"},"cname":{"description":"Content of the './CNAME' file.","type":"string"},"contentDir":{"description":"Generated section content directory.","type":"string"},"description":{"type":"string"},"dir":{"type":"string"},"entries":{"items":{"$ref":"#/definitions/EntryConfig"},"type":"array"},"favicon":{"description":"Favicon URL.","type":"string"},"faviconType":{"type":"string"},"htmlTitle":{"type":"string"},"id":{"type":"string"},"jsorg":{"description":"As a boolean, it means whether to add the '<package_name>.js.org' domain to the './CNAME' file.\n\nAs a string, it sets the '<jsorg_value>.js.org' domain to the './CNAME' file.","type":["boolean","string"]},"linkColor":{"type":"string"},"linkMap":{"additionalProperties":{"anyOf":[{"type":"string"},{"not":{}}]},"description":"Link substitution map.","type":"object"},"mainBranch":{"type":"string"},"name":{"type":"string"},"nav":{"description":"URL of an HTML file inserted into the navigation bar.","type":"string"},"npm":{"type":"string"},"redirect":{"description":"Redirection URL.","type":"string"},"remove":{"description":"Whether to remove the GitHub Pages branch and quit.","type":"boolean"},"repo":{"type":"string"},"root":{"description":"Main page root path.","type":"string"},"singlePage":{"description":"Whether to show all sections on a single page.","type":"boolean"},"source":{"type":"string"},"targetBranch":{"description":"Target branch.","examples":["gh-pages"],"type":"string"},"targetIds":{"items":{"type":"string"},"type":"array"},"theme":{"type":"string"},"title":{"type":"string"},"version":{"type":"string"},"ymid":{"type":["number","string"]}},"type":"object"},"ContentInjectionMap<(\"head\"|\"body\"|\":has-code\")>":{"additionalProperties":false,"properties":{":has-code":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"},{"items":{"anyOf":[{"type":"string"},{"not":{}},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"}]},"type":"array"}]},"body":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"},{"items":{"anyOf":[{"type":"string"},{"not":{}},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"}]},"type":"array"}]},"head":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"},{"items":{"anyOf":[{"type":"string"},{"not":{}},{"additionalProperties":false,"properties":{"content":{"type":"string"},"pages":{"items":{"$ref":"#/definitions/Page"},"type":"array"}},"type":"object"}]},"type":"array"}]}},"type":"object"},"EntryConfig":{"additionalProperties":false,"properties":{"append":{"$ref":"#/definitions/ContentInjectionMap%3C(%22head%22%7C%22body%22%7C%22%3Ahas-code%22)%3E"},"assetsDir":{"description":"Directory path for assets, relative to `dir`. If not provided, the assets will be added via the package URLs.","type":"string"},"backstory":{"description":"Backstory link URL to be added to the front page.","type":"string"},"baseColor":{"type":"string"},"cname":{"description":"Content of the './CNAME' file.","type":"string"},"contentDir":{"description":"Generated section content directory.","type":"string"},"description":{"type":"string"},"dir":{"type":"string"},"favicon":{"description":"Favicon URL.","type":"string"},"faviconType":{"type":"string"},"htmlTitle":{"type":"string"},"id":{"type":"string"},"jsorg":{"description":"As a boolean, it means whether to add the '<package_name>.js.org' domain to the './CNAME' file.\n\nAs a string, it sets the '<jsorg_value>.js.org' domain to the './CNAME' file.","type":["boolean","string"]},"linkColor":{"type":"string"},"linkMap":{"additionalProperties":{"anyOf":[{"type":"string"},{"not":{}}]},"description":"Link substitution map.","type":"object"},"mainBranch":{"type":"string"},"name":{"type":"string"},"nav":{"description":"URL of an HTML file inserted into the navigation bar.","type":"string"},"npm":{"type":"string"},"redirect":{"description":"Redirection URL.","type":"string"},"remove":{"description":"Whether to remove the GitHub Pages branch and quit.","type":"boolean"},"repo":{"type":"string"},"root":{"description":"Main page root path.","type":"string"},"singlePage":{"description":"Whether to show all sections on a single page.","type":"boolean"},"source":{"type":"string"},"targetBranch":{"description":"Target branch.","examples":["gh-pages"],"type":"string"},"theme":{"type":"string"},"title":{"type":"string"},"version":{"type":"string"},"ymid":{"type":["number","string"]}},"type":"object"},"Page":{"enum":["index","start","section","redirect"],"type":"string"}}}
|
package/src/bin/setContent.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { getIcon } from "./getIcon.ts";
|
|
|
12
12
|
import { getInjectedContent } from "./getInjectedContent.ts";
|
|
13
13
|
import { getNav } from "./getNav.ts";
|
|
14
14
|
import { getRepoLink } from "./getRepoLink.ts";
|
|
15
|
-
import { getTitle } from "./getTitle.ts";
|
|
16
15
|
import { getParsedContent } from "./parsing/getParsedContent.ts";
|
|
17
16
|
import { stripHTML } from "./stripHTML.ts";
|
|
18
17
|
import { toFileContent } from "./toFileContent.ts";
|
|
@@ -49,14 +48,13 @@ export async function setContent(ctx: Context) {
|
|
|
49
48
|
contentDir = "",
|
|
50
49
|
name,
|
|
51
50
|
title,
|
|
51
|
+
htmlTitle,
|
|
52
52
|
description: packageDescription,
|
|
53
53
|
backstory,
|
|
54
54
|
redirect,
|
|
55
55
|
} = ctx;
|
|
56
56
|
|
|
57
57
|
let counterContent = getCounterContent(ctx);
|
|
58
|
-
let escapedName = escapeHTML(name);
|
|
59
|
-
let escapedTitle = title ? escapeHTML(title) : escapedName;
|
|
60
58
|
let escapedPackageDescription = escapeHTML(packageDescription);
|
|
61
59
|
|
|
62
60
|
let rootAttrs = "";
|
|
@@ -129,8 +127,21 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
129
127
|
return;
|
|
130
128
|
}
|
|
131
129
|
|
|
132
|
-
let {
|
|
133
|
-
|
|
130
|
+
let {
|
|
131
|
+
title: parsedTitle,
|
|
132
|
+
description,
|
|
133
|
+
intro,
|
|
134
|
+
features,
|
|
135
|
+
note,
|
|
136
|
+
installation,
|
|
137
|
+
sections,
|
|
138
|
+
nav,
|
|
139
|
+
} = await getParsedContent(ctx);
|
|
140
|
+
|
|
141
|
+
let plainTitle = escapeHTML(
|
|
142
|
+
title || stripHTML(htmlTitle || parsedTitle, true) || name,
|
|
143
|
+
);
|
|
144
|
+
let coverTitle = htmlTitle || parsedTitle || plainTitle;
|
|
134
145
|
|
|
135
146
|
let descriptionContent =
|
|
136
147
|
tweakTypography(description) ||
|
|
@@ -163,8 +174,8 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
163
174
|
<head>
|
|
164
175
|
<meta charset="utf-8">
|
|
165
176
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
166
|
-
<meta name="description" content="${
|
|
167
|
-
<title>${escapeHTML(stripHTML(nav[i]?.title, true))} | ${
|
|
177
|
+
<meta name="description" content="${plainTitle}: ${escapeHTML(stripHTML(nav[i]?.title, true))}">
|
|
178
|
+
<title>${escapeHTML(stripHTML(nav[i]?.title, true))} | ${plainTitle}</title>
|
|
168
179
|
<link rel="stylesheet" href="${cssRoot.content}/base.css">
|
|
169
180
|
<link rel="stylesheet" href="${cssRoot.content}/section.css">
|
|
170
181
|
${iconTag}
|
|
@@ -176,7 +187,7 @@ ${getInjectedContent(ctx, "redirect", "body")}
|
|
|
176
187
|
<div class="layout">
|
|
177
188
|
<div class="${navContent ? "" : "no-nav "}body">
|
|
178
189
|
<main>
|
|
179
|
-
<h1
|
|
190
|
+
<h1><a href="${root}">${coverTitle}</a></h1>
|
|
180
191
|
${content}
|
|
181
192
|
|
|
182
193
|
<p class="pagenav">
|
|
@@ -219,8 +230,8 @@ ${getInjectedContent(ctx, "section", "body")}
|
|
|
219
230
|
<head>
|
|
220
231
|
<meta charset="utf-8">
|
|
221
232
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
222
|
-
<meta name="description" content="${
|
|
223
|
-
<title>${
|
|
233
|
+
<meta name="description" content="${plainTitle}${escapedPackageDescription ? `: ${escapedPackageDescription}` : ""}">
|
|
234
|
+
<title>${plainTitle}${escapedPackageDescription ? ` | ${escapedPackageDescription}` : ""}</title>
|
|
224
235
|
<link rel="stylesheet" href="${cssRoot.index}/base.css">
|
|
225
236
|
<link rel="stylesheet" href="${cssRoot.index}/index.css">
|
|
226
237
|
${iconTag}
|
|
@@ -233,7 +244,7 @@ ${getInjectedContent(ctx, "section", "body")}
|
|
|
233
244
|
<main>
|
|
234
245
|
<section class="b1 intro-title">
|
|
235
246
|
<div class="section-content">
|
|
236
|
-
<h1>${
|
|
247
|
+
<h1>${coverTitle}</h1>
|
|
237
248
|
<div class="description">
|
|
238
249
|
${descriptionContent}
|
|
239
250
|
</div>
|
|
@@ -286,7 +297,7 @@ ${getInjectedContent(ctx, "index", "body")}
|
|
|
286
297
|
<meta charset="utf-8">
|
|
287
298
|
<meta name="viewport" content="width=device-width">
|
|
288
299
|
<meta http-equiv="refresh" content="0; URL=${root}${contentDir}/${nav[0]?.id}">
|
|
289
|
-
<title>${
|
|
300
|
+
<title>${plainTitle}</title>
|
|
290
301
|
<link rel="stylesheet" href="${cssRoot.index}/base.css">
|
|
291
302
|
${iconTag}
|
|
292
303
|
<script>window.location.replace("${root}${contentDir}/${nav[0]?.id}");</script>
|
|
@@ -294,7 +305,7 @@ ${getInjectedContent(ctx, "index", "body")}
|
|
|
294
305
|
</head>
|
|
295
306
|
<body>
|
|
296
307
|
<div class="layout">
|
|
297
|
-
<h1>${
|
|
308
|
+
<h1>${plainTitle}</h1>
|
|
298
309
|
</div>
|
|
299
310
|
|
|
300
311
|
${counterContent}
|
package/src/bin/stripHTML.ts
CHANGED
package/src/types/EntryConfig.ts
CHANGED
package/src/bin/getTitle.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Context } from "../types/Context.ts";
|
|
2
|
-
import { escapeHTML } from "../utils/escapeHTML.ts";
|
|
3
|
-
|
|
4
|
-
type GetTitleParams = {
|
|
5
|
-
cover?: boolean;
|
|
6
|
-
originalContent?: string;
|
|
7
|
-
withPackageURL?: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function getTitle(
|
|
11
|
-
ctx: Context,
|
|
12
|
-
{ cover, originalContent, withPackageURL }: GetTitleParams = {},
|
|
13
|
-
) {
|
|
14
|
-
let { root, name, title: packageTitle, htmlTitle, scope } = ctx;
|
|
15
|
-
|
|
16
|
-
if (originalContent && ![name, packageTitle].includes(originalContent.trim()))
|
|
17
|
-
return originalContent;
|
|
18
|
-
|
|
19
|
-
if (cover && htmlTitle) return htmlTitle;
|
|
20
|
-
|
|
21
|
-
if (packageTitle) {
|
|
22
|
-
let escapedTitle = escapeHTML(packageTitle);
|
|
23
|
-
|
|
24
|
-
return withPackageURL
|
|
25
|
-
? `<a href="${root}" class="name">${escapedTitle}</a>`
|
|
26
|
-
: `<span class="name">${escapedTitle}</span>`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let scopeMatches = name?.match(/^(@[^/]+)\/?(.*)/);
|
|
30
|
-
|
|
31
|
-
if (!scope || !scopeMatches) {
|
|
32
|
-
let escapedName = escapeHTML(name);
|
|
33
|
-
|
|
34
|
-
return withPackageURL
|
|
35
|
-
? `<a href="${root}" class="name">${escapedName}</a>`
|
|
36
|
-
: `<span class="name">${escapedName}</span>`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let title =
|
|
40
|
-
`<a href="${scope}" class="scope">${scopeMatches[1]}</a>` +
|
|
41
|
-
'<span class="sep">/</span>';
|
|
42
|
-
|
|
43
|
-
title += withPackageURL
|
|
44
|
-
? `<a href="${root}" class="name">${scopeMatches[2]}</a>`
|
|
45
|
-
: `<span class="name">${scopeMatches[2]}</span>`;
|
|
46
|
-
|
|
47
|
-
return title;
|
|
48
|
-
}
|