astro-custom-toc 1.0.0 → 1.0.2
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/README.md +2 -2
- package/package.json +1 -1
- package/remark-custom-toc.ts +1 -1
package/README.md
CHANGED
|
@@ -23,12 +23,12 @@ Add the plugin to your `astro.config.mjs`. **This plugin must be inserted before
|
|
|
23
23
|
|
|
24
24
|
```javascript
|
|
25
25
|
import { defineConfig } from "astro/config";
|
|
26
|
-
import
|
|
26
|
+
import customToc from "./src/plugins/remark-toc";
|
|
27
27
|
|
|
28
28
|
// https://astro.build/config
|
|
29
29
|
export default defineConfig({
|
|
30
30
|
// ... other config
|
|
31
|
-
integrations: [
|
|
31
|
+
integrations: [customToc(), mdx()]
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
package/package.json
CHANGED
package/remark-custom-toc.ts
CHANGED
|
@@ -94,7 +94,7 @@ const generateToc = (template: RemarkCustomTocTemplate, maxDepth: number, ordere
|
|
|
94
94
|
const { document } = new JSDOM().window;
|
|
95
95
|
|
|
96
96
|
const toc: HTMLElement = document.createElement(ordered ? "ol" : "ul");
|
|
97
|
-
let currentDepth =
|
|
97
|
+
let currentDepth = headings[0].depth;
|
|
98
98
|
let currentParent = toc;
|
|
99
99
|
for (const heading of headings) {
|
|
100
100
|
if (heading.depth > maxDepth) continue;
|