@t8/docsgen 0.3.5 → 0.3.7

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
@@ -445,11 +445,11 @@ function buildNav(ctx, dom) {
445
445
  let isSectionTitle = tagName === "h2";
446
446
  let isSubsectionTitle = tagName === "h3";
447
447
  let slug = getSlug(element.textContent);
448
- let sectionId = isSectionTitle ? slug : navItem?.id ?? "";
448
+ let sectionId = isSectionTitle && !singlePage ? slug : navItem?.id ?? "";
449
449
  let link = `${root}${contentDir}/${sectionId}`;
450
450
  let elementId = element.id || slug.toLowerCase().replace(/_/g, "-");
451
451
  if (elementId)
452
- linkMap[`#${elementId}`] = `${link}${isSectionTitle ? "" : `#${slug}`}`;
452
+ linkMap[`#${elementId}`] = `${link}${isSectionTitle && !singlePage ? "" : `#${slug}`}`;
453
453
  if (singlePage && isSectionTitle) {
454
454
  if (navItem) {
455
455
  element.id = slug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t8/docsgen",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "",
5
5
  "main": "dist/bin.js",
6
6
  "type": "module",
@@ -27,13 +27,14 @@ export function buildNav(ctx: Context, dom: JSDOM) {
27
27
  let isSubsectionTitle = tagName === "h3";
28
28
  let slug = getSlug(element.textContent);
29
29
 
30
- let sectionId = isSectionTitle ? slug : (navItem?.id ?? "");
30
+ let sectionId = isSectionTitle && !singlePage ? slug : (navItem?.id ?? "");
31
31
  let link = `${root}${contentDir}/${sectionId}`;
32
32
 
33
33
  let elementId = element.id || slug.toLowerCase().replace(/_/g, "-");
34
34
 
35
35
  if (elementId)
36
- linkMap[`#${elementId}`] = `${link}${isSectionTitle ? "" : `#${slug}`}`;
36
+ linkMap[`#${elementId}`] =
37
+ `${link}${isSectionTitle && !singlePage ? "" : `#${slug}`}`;
37
38
 
38
39
  if (singlePage && isSectionTitle) {
39
40
  if (navItem) {