@mdit-vue/plugin-toc 0.11.2 → 0.12.0

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
@@ -75,6 +75,18 @@ const md = MarkdownIt({ html: true }).use(tocPlugin, {
75
75
 
76
76
  When using this plugin with [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) (recommended), this option should be a subset of markdown-it-anchor's `level` option to ensure the target links are existed.
77
77
 
78
+ ### shouldAllowNested
79
+
80
+ - Type: `boolean`
81
+
82
+ - Default: `false`
83
+
84
+ - Details:
85
+
86
+ Should allow headers inside nested blocks or not.
87
+
88
+ If set to `true`, headers inside blockquote, list, etc. would also be included.
89
+
78
90
  ### containerTag
79
91
 
80
92
  - Type: `string`
package/dist/index.cjs CHANGED
@@ -61,6 +61,7 @@ const tocPlugin = (md, {
61
61
  slugify = shared.slugify,
62
62
  format,
63
63
  level = [2, 3],
64
+ shouldAllowNested = false,
64
65
  containerTag = "nav",
65
66
  containerClass = "table-of-contents",
66
67
  listTag = "ul",
@@ -92,6 +93,7 @@ const tocPlugin = (md, {
92
93
  shared.resolveHeadersFromTokens(tokens, {
93
94
  level,
94
95
  shouldAllowHtml: true,
96
+ shouldAllowNested,
95
97
  shouldEscapeText: true,
96
98
  slugify,
97
99
  format
package/dist/index.d.ts CHANGED
@@ -32,6 +32,14 @@ interface TocPluginOptions {
32
32
  * @default [2,3]
33
33
  */
34
34
  level?: number[];
35
+ /**
36
+ * Should allow headers inside nested blocks or not
37
+ *
38
+ * If set to `true`, headers inside blockquote, list, etc. would also be included.
39
+ *
40
+ * @default false
41
+ */
42
+ shouldAllowNested?: boolean;
35
43
  /**
36
44
  * HTML tag of the TOC container
37
45
  *
package/dist/index.mjs CHANGED
@@ -59,6 +59,7 @@ const tocPlugin = (md, {
59
59
  slugify: slugify$1 = slugify,
60
60
  format,
61
61
  level = [2, 3],
62
+ shouldAllowNested = false,
62
63
  containerTag = "nav",
63
64
  containerClass = "table-of-contents",
64
65
  listTag = "ul",
@@ -90,6 +91,7 @@ const tocPlugin = (md, {
90
91
  resolveHeadersFromTokens(tokens, {
91
92
  level,
92
93
  shouldAllowHtml: true,
94
+ shouldAllowNested,
93
95
  shouldEscapeText: true,
94
96
  slugify: slugify$1,
95
97
  format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdit-vue/plugin-toc",
3
- "version": "0.11.2",
3
+ "version": "0.12.0",
4
4
  "description": "A markdown-it plugin to generate table-of-contents that compatible with Vue.js",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -38,8 +38,8 @@
38
38
  "test": "vitest"
39
39
  },
40
40
  "dependencies": {
41
- "@mdit-vue/shared": "0.11.2",
42
- "@mdit-vue/types": "0.11.0",
41
+ "@mdit-vue/shared": "0.12.0",
42
+ "@mdit-vue/types": "0.12.0",
43
43
  "@types/markdown-it": "^12.2.3",
44
44
  "markdown-it": "^13.0.1"
45
45
  },
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "676ec4ca8704d709e7a47f7f6d41ff3f70dc2356"
52
+ "gitHead": "986b6023d3460cadefd409cd5d4b6445af3a05bd"
53
53
  }