@t8/docsgen 0.1.40 → 0.1.41
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 +3 -3
- package/package.json +1 -1
- package/src/bin/getParsedContent.ts +3 -4
package/dist/bin.js
CHANGED
|
@@ -446,8 +446,9 @@ function buildNav(ctx, dom) {
|
|
|
446
446
|
let slug = getSlug(element.textContent);
|
|
447
447
|
let sectionId = isSectionTitle ? slug : navItem?.id ?? "";
|
|
448
448
|
let link = `${root}${contentDir}/${sectionId}`;
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
let elementId = element.id || slug.toLowerCase().replace(/_/g, "-");
|
|
450
|
+
if (elementId)
|
|
451
|
+
linkMap[`#${elementId}`] = `${link}${isSectionTitle ? "" : `#${slug}`}`;
|
|
451
452
|
if (singlePage && isSectionTitle) {
|
|
452
453
|
if (navItem) {
|
|
453
454
|
element.id = slug;
|
|
@@ -457,7 +458,6 @@ function buildNav(ctx, dom) {
|
|
|
457
458
|
});
|
|
458
459
|
}
|
|
459
460
|
} else if (isSectionTitle) {
|
|
460
|
-
element.id = slug;
|
|
461
461
|
if (navItem) nav.push(navItem);
|
|
462
462
|
navItem = {
|
|
463
463
|
id: slug,
|
package/package.json
CHANGED
|
@@ -41,9 +41,10 @@ function buildNav(ctx: Context, dom: JSDOM) {
|
|
|
41
41
|
let sectionId = isSectionTitle ? slug : (navItem?.id ?? "");
|
|
42
42
|
let link = `${root}${contentDir}/${sectionId}`;
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
let elementId = element.id || slug.toLowerCase().replace(/_/g, "-");
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
if (elementId)
|
|
47
|
+
linkMap[`#${elementId}`] = `${link}${isSectionTitle ? "" : `#${slug}`}`;
|
|
47
48
|
|
|
48
49
|
if (singlePage && isSectionTitle) {
|
|
49
50
|
if (navItem) {
|
|
@@ -54,8 +55,6 @@ function buildNav(ctx: Context, dom: JSDOM) {
|
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
} else if (isSectionTitle) {
|
|
57
|
-
element.id = slug;
|
|
58
|
-
|
|
59
58
|
if (navItem) nav.push(navItem);
|
|
60
59
|
|
|
61
60
|
navItem = {
|