@rspress/core 1.8.3 → 1.8.4
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/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/loader.js +8 -3
- package/dist/loader.js.map +1 -1
- package/package.json +13 -13
package/dist/loader.js
CHANGED
|
@@ -3697,13 +3697,18 @@ var parseToc = (tree) => {
|
|
|
3697
3697
|
if (node.depth > 1 && node.depth < 5) {
|
|
3698
3698
|
let customId = "";
|
|
3699
3699
|
const text = node.children.map((child) => {
|
|
3700
|
-
if (child.type === "link") {
|
|
3701
|
-
return child.children?.map((item) => item.value).join("");
|
|
3702
|
-
}
|
|
3700
|
+
if (child.type === "link" || child.type === "strong") {
|
|
3701
|
+
return child.children?.map((item) => item.type === "text" ? item.value : "").join("");
|
|
3702
|
+
}
|
|
3703
|
+
if (child.type === "text") {
|
|
3703
3704
|
const [textPart, idPart] = extractTextAndId(child.value);
|
|
3704
3705
|
customId = idPart;
|
|
3705
3706
|
return textPart;
|
|
3706
3707
|
}
|
|
3708
|
+
if (child.type === "inlineCode") {
|
|
3709
|
+
return child.value;
|
|
3710
|
+
}
|
|
3711
|
+
return "";
|
|
3707
3712
|
}).join("");
|
|
3708
3713
|
const id = customId ? customId : slugger.slug(text);
|
|
3709
3714
|
const { depth } = node;
|