Skip to content

Commit 79d0fe7

Browse files
committed
typo
1 parent 83fd801 commit 79d0fe7

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ pnpm install @mehm8128/rehype-toc
2121
### astro.config.mjs
2222

2323
```ts
24-
import { rehypeCollapsableToc } from "@mehm8128/rehype-toc";
24+
import { rehypeCollapsibleToc } from "@mehm8128/rehype-toc";
2525

2626
export default defineConfig({
2727
markdown: {
28-
rehypePlugins: [rehypeCollapsableToc],
28+
rehypePlugins: [rehypeCollapsibleToc],
2929
},
3030
});
3131
```
@@ -34,8 +34,8 @@ export default defineConfig({
3434

3535
```ts
3636
import { rehype } from "rehype"
37-
import { rehypeCollapsableToc } from "@mehm8128/rehype-toc";
37+
import { rehypeCollapsibleToc } from "@mehm8128/rehype-toc";
3838

3939
const input = "<h2 id="heading-id"><a href="#heading-id">Heading</a></h2>";
40-
const { value } = await rehype().use(rehypeCollapsableToc).process(input);
40+
const { value } = await rehype().use(rehypeCollapsibleToc).process(input);
4141
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"homepage": "https://github.com/mehm8128/rehype-toc",
1010
"license": "MIT",
11-
"description": "rehype plugin to generate a collapsable table of contents",
11+
"description": "rehype plugin to generate a collapsible table of contents",
1212
"keywords": [
1313
"rehype",
1414
"toc",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Element, ElementContent, Root, Text } from 'hast'
22
import { visit } from 'unist-util-visit'
33

4-
export const rehypeCollapsableToc = () => {
4+
export const rehypeCollapsibleToc = () => {
55
return (tree: Root) => {
66
const rootUlElement: Element = {
77
type: 'element',
@@ -14,7 +14,7 @@ export const rehypeCollapsableToc = () => {
1414
visitorCallback(node, rootUlElement)
1515
})
1616

17-
const detailsElement = createCollapsableToc(rootUlElement)
17+
const detailsElement = createCollapsibleToc(rootUlElement)
1818
tree.children.unshift(detailsElement)
1919
}
2020
}
@@ -140,7 +140,7 @@ const createListItemElement = (node: Element): Element => {
140140
}
141141
}
142142

143-
const createCollapsableToc = (rootUlElement: Element): Element => {
143+
const createCollapsibleToc = (rootUlElement: Element): Element => {
144144
const summaryElement: Element = {
145145
type: 'element',
146146
tagName: 'summary',

tests/__snapshots__/index.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`rehypeCollapsableToc > h2だけのとき、同じレベルで作成される 1`] = `
3+
exports[`rehypeCollapsibleToc > h2だけのとき、同じレベルで作成される 1`] = `
44
"<details><summary>目次</summary><ol><li><a href="#Heading 1">Heading 1</a></li><li><a href="#Heading 2">Heading 2</a></li><li><a href="#Heading 3">Heading 3</a></li></ol></details><html><head></head><body><h2 id="heading-1"><a href="#heading-1">Heading 1</a></h2>
55
<h2 id="heading-2"><a href="#heading-2">Heading 2</a></h2>
66
<h2 id="heading-3"><a href="#heading-3">Heading 3</a></h2>
77
</body></html>"
88
`;
99

10-
exports[`rehypeCollapsableToc > h2以外で同じレベルの見出しが適切に作成される 1`] = `
10+
exports[`rehypeCollapsibleToc > h2以外で同じレベルの見出しが適切に作成される 1`] = `
1111
"<details><summary>目次</summary><ol><li><a href="#Heading 1">Heading 1</a><ol><li><a href="#Heading 1-1">Heading 1-1</a><ol><li><a href="#Heading 1-2">Heading 1-2</a><ol><li><a href="#Heading 1-2-1">Heading 1-2-1</a><ol><li><a href="#Heading 1-2-2">Heading 1-2-2</a></li></ol></li></ol></li></ol></li></ol></li></ol></details><html><head></head><body><h2 id="heading-1"><a href="#heading-1">Heading 1</a></h2>
1212
<h3 id="heading-1-1"><a href="#heading-1-1">Heading 1-1</a></h3>
1313
<h3 id="heading-1-2"><a href="#heading-1-2">Heading 1-2</a></h3>
@@ -16,7 +16,7 @@ exports[`rehypeCollapsableToc > h2以外で同じレベルの見出しが適切
1616
</body></html>"
1717
`;
1818

19-
exports[`rehypeCollapsableToc > 低いレベルの見出しに戻るときにも適切に作成される 1`] = `
19+
exports[`rehypeCollapsibleToc > 低いレベルの見出しに戻るときにも適切に作成される 1`] = `
2020
"<details><summary>目次</summary><ol><li><a href="#Heading 1">Heading 1</a><ol><li><a href="#Heading 1-1">Heading 1-1</a><ol><li><a href="#Heading 1-1-1">Heading 1-1-1</a><ol><li><a href="#Heading 2">Heading 2</a><ol><li><a href="#Heading 2-1">Heading 2-1</a></li></ol></li></ol></li></ol></li></ol></li><li><a href="#Heading 3">Heading 3</a></li></ol></details><html><head></head><body><h2 id="heading-1"><a href="#heading-1">Heading 1</a></h2>
2121
<h3 id="heading-1-1"><a href="#heading-1-1">Heading 1-1</a></h3>
2222
<h4 id="heading-1-1-1"><a href="#heading-1-1-1">Heading 1-1-1</a></h4>

tests/index.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { rehype } from 'rehype'
22
import { describe, expect, test } from 'vitest'
3-
import { rehypeCollapsableToc } from '../src'
3+
import { rehypeCollapsibleToc } from '../src'
44

5-
describe('rehypeCollapsableToc', () => {
5+
describe('rehypeCollapsibleToc', () => {
66
test('h2だけのとき、同じレベルで作成される', async () => {
77
const input = `
88
<h2 id="heading-1"><a href="#heading-1">Heading 1</a></h2>
99
<h2 id="heading-2"><a href="#heading-2">Heading 2</a></h2>
1010
<h2 id="heading-3"><a href="#heading-3">Heading 3</a></h2>
1111
`
12-
const { value } = await rehype().use(rehypeCollapsableToc).process(input)
12+
const { value } = await rehype().use(rehypeCollapsibleToc).process(input)
1313
expect(value).toMatchSnapshot()
1414
})
1515
test('h2以外で同じレベルの見出しが適切に作成される', async () => {
@@ -20,7 +20,7 @@ describe('rehypeCollapsableToc', () => {
2020
<h4 id="heading-1-2-1"><a href="#heading-1-2-1">Heading 1-2-1</a></h4>
2121
<h4 id="heading-1-2-2"><a href="#heading-1-2-2">Heading 1-2-2</a></h4>
2222
`
23-
const { value } = await rehype().use(rehypeCollapsableToc).process(input)
23+
const { value } = await rehype().use(rehypeCollapsibleToc).process(input)
2424
expect(value).toMatchSnapshot()
2525
})
2626
test('低いレベルの見出しに戻るときにも適切に作成される', async () => {
@@ -32,7 +32,7 @@ describe('rehypeCollapsableToc', () => {
3232
<h4 id="heading-2-1"><a href="#heading-2-1">Heading 2-1</a></h4>
3333
<h2 id="heading-3"><a href="#heading-3">Heading 3</a></h2>
3434
`
35-
const { value } = await rehype().use(rehypeCollapsableToc).process(input)
35+
const { value } = await rehype().use(rehypeCollapsibleToc).process(input)
3636
expect(value).toMatchSnapshot()
3737
})
3838
})

0 commit comments

Comments
 (0)