Skip to content

Commit

Permalink
idPropertyNameの初期値をariaLabelledbyに変更 (#10)
Browse files Browse the repository at this point in the history
* chore: release-drafterの削除

* chore: node14を対象から削除

* fix: idPropertyNameの初期値をariaLabelledbyに変更

* 1.0.3
  • Loading branch information
hbsnow authored Dec 17, 2022
1 parent d2fa701 commit 95aa7ba
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 37 deletions.
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

0 comments on commit 95aa7ba

Please sign in to comment.