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 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 { remarkCustomToc } from "./src/plugins/remark-toc";
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: [remarkCustomToc(), mdx()]
31
+ integrations: [customToc(), mdx()]
32
32
  });
33
33
  ```
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-custom-toc",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Astro Integration to generate a customizable table of contents",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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 = 2;
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;