@mehm8128/rehype-toc 1.4.2 → 1.4.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.
Files changed (2) hide show
  1. package/dist/index.js +12 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ const rehypeCollapsibleToc = () => {
6
6
  const rootOlElement = {
7
7
  type: "element",
8
8
  tagName: "ol",
9
- properties: {},
9
+ properties: { className: ["rehype-toc-ol"] },
10
10
  children: []
11
11
  };
12
12
  visit(tree, "element", (node) => {
@@ -63,7 +63,7 @@ const createOlElement = () => {
63
63
  return {
64
64
  type: "element",
65
65
  tagName: "ol",
66
- properties: {},
66
+ properties: { className: ["rehype-toc-ol"] },
67
67
  children: []
68
68
  };
69
69
  };
@@ -76,7 +76,10 @@ const createListItemElement = (node) => {
76
76
  const anchorElement = {
77
77
  type: "element",
78
78
  tagName: "a",
79
- properties: { href: `#${headingId}` },
79
+ properties: {
80
+ href: `#${headingId}`,
81
+ className: ["rehype-toc-a"]
82
+ },
80
83
  children: [{
81
84
  type: "text",
82
85
  value: headingText
@@ -85,7 +88,7 @@ const createListItemElement = (node) => {
85
88
  return {
86
89
  type: "element",
87
90
  tagName: "li",
88
- properties: {},
91
+ properties: { className: ["rehype-toc-li"] },
89
92
  children: [anchorElement]
90
93
  };
91
94
  };
@@ -93,7 +96,7 @@ const createCollapsibleToc = (rootOlElement) => {
93
96
  const summaryElement = {
94
97
  type: "element",
95
98
  tagName: "summary",
96
- properties: {},
99
+ properties: { className: ["rehype-toc-summary"] },
97
100
  children: [{
98
101
  type: "text",
99
102
  value: "目次"
@@ -102,7 +105,10 @@ const createCollapsibleToc = (rootOlElement) => {
102
105
  const detailsElement = {
103
106
  type: "element",
104
107
  tagName: "details",
105
- properties: {},
108
+ properties: {
109
+ open: true,
110
+ className: ["rehype-toc-details"]
111
+ },
106
112
  children: [summaryElement, rootOlElement]
107
113
  };
108
114
  return detailsElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mehm8128/rehype-toc",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",