Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idPropertyNameの初期値をariaLabelledbyに変更 #10

Merged
merged 4 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/release-drafter.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -24,3 +24,5 @@ jobs:
run: npm run lint
- name: Run unit tests
run: npm test
- name: Run unit build
run: npm run test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ npm i -D @hbsnow/rehype-sectionize
### Output

```html
<section class="heading" data-heading-rank="1" data-heading-id="h1-id">
<section class="heading" data-heading-rank="1" aria-labelledby="h1-id">
<h1 id="h1-id">h1</h1>
<section class="heading" data-heading-rank="2" data-heading-id="h2-id">
<section class="heading" data-heading-rank="2" aria-labelledby="h2-id">
<h2 id="h2-id">h2</h2>
<section class="heading" data-heading-rank="3" data-heading-id="h3-id">
<section class="heading" data-heading-rank="3" aria-labelledby="h3-id">
<h3 id="h3-id">h3</h3>
</section>
</section>
Expand All @@ -43,7 +43,7 @@ npm i -D @hbsnow/rehype-sectionize
| `properties` | `hastscript.Properties` | `{}` | Attributes assigned to section |
| `enableRootSection` | `boolean` | `false` | Section to wrap all |
| `rankPropertyName` | `string` | `dataHeadingRank` | Name of rank data attribute |
| `idPropertyName` | `string` | `dataHeadingId` | Name of id data attribute |
| `idPropertyName` | `string` | `ariaLabelledby` | Name of id data attribute |

## License

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hbsnow/rehype-sectionize",
"version": "1.0.2",
"version": "1.0.3",
"description": "rehype plugin that wraps section based on heading",
"type": "module",
"main": "dist/index.js",
Expand Down Expand Up @@ -48,6 +48,6 @@
"hast-util-heading-rank": "2.1.0"
},
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const defaultOptions: Required<RehypeSectionizeOptions> = {
properties: {},
enableRootSection: false,
rankPropertyName: "dataHeadingRank",
idPropertyName: "dataHeadingId",
idPropertyName: "ariaLabelledby",
};

const wrappingRank = (
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/headingId/output.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<section class="heading" data-heading-rank="1" data-heading-id="h1-id">
<section class="heading" data-heading-rank="1" aria-labelledby="h1-id">
<h1 id="h1-id">h1</h1>
<section class="heading" data-heading-rank="2" data-heading-id="h2-id">
<section class="heading" data-heading-rank="2" aria-labelledby="h2-id">
<h2 id="h2-id">h2</h2>
<section class="heading" data-heading-rank="3" data-heading-id="h3-id">
<section class="heading" data-heading-rank="3" aria-labelledby="h3-id">
<h3 id="h3-id">h3</h3>
</section>
</section>
Expand Down