Skip to content

Commit 4e442fa

Browse files
authored
Rewrite html plugin (#23)
Rewrite ALL!!! ## Breaking Changes - Require [textlint v13.0.0](https://textlint.github.io/blog/2023/01/27/textlint-13.html)+ - html plugin is written in Pure ESM - Require Node.js 16+ - Convert JavaScript to TypeScript ## Features - use [rehype](https://github.com/rehypejs/rehype#readme) instead of hast - support `<h1>` ... `<h6>`'s `levels` - support `<ul>` and `<ol>` - support `<img />`'s `alt` and `title` - support `<a>`'s `title` ## Bug Fixes fix #19 fix textlint-ja/textlint-rule-no-synonyms#4 fix #2 close #15 - It looks like rule implementation issue https://github.com/KeitaMoromizato/textlint-rule-max-appearence-count-of-words/blob/master/src/max-appearence-count-of-words.js ## Testings - New snapshot testing - Tree Dump view for human 📝 Welcome to contribute! We looking for new maintainer! - #21
1 parent 4435db6 commit 4e442fa

File tree

166 files changed

+26480
-10930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+26480
-10930
lines changed

.babelrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,31 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node-version: [12, 14]
9+
node-version: [16,18]
1010
steps:
1111
- name: checkout
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313
- name: setup Node.js ${{ matrix.node-version }}
14-
uses: actions/setup-node@v2
14+
uses: actions/setup-node@v3
1515
with:
1616
node-version: ${{ matrix.node-version }}
1717
- name: Install
18-
run: npm install
18+
run: yarn install
1919
- name: Test
20-
run: npm test
20+
run: yarn test
21+
example:
22+
name: "Run Example"
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: checkout
26+
uses: actions/checkout@v3
27+
- name: setup Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
- name: Install
32+
run: yarn install
33+
working-directory: ./example
34+
- name: Test
35+
run: yarn test
36+
working-directory: ./example

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/lib
2+
/module
23
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Node.gitignore
34

45
# Logs

.mocharc.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"timeout": "5000",
3-
"require": [
4-
"@babel/register"
5-
]
2+
"$schema": "https://json.schemastore.org/mocharc",
3+
"loader": "ts-node/esm",
4+
"spec": [
5+
"test/**/*.{js,ts}"
6+
],
7+
"timeout": 10000
68
}

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
Add HTML support for [textlint](https://github.com/textlint/textlint "textlint").
44

5-
What is textlint plugin? Please see https://github.com/textlint/textlint/blob/master/docs/plugin.md
6-
5+
What is textlint plugin? Please see <https://github.com/textlint/textlint/blob/master/docs/plugin.md>
76

87
## Installation
98

109
npm install textlint-plugin-html
1110

11+
Requirements:
12+
13+
- textlint v13+
14+
1215
## Default supported extensions
1316

1417
- `.html`
@@ -52,6 +55,16 @@ For example, if you want to treat `.custom-ext` as html, put following config to
5255

5356
npm test
5457

58+
## Development
59+
60+
If you update snapshot, please run `npm run updateSnapshot`.
61+
62+
### Add new test case
63+
64+
1. add new fixture file to `test/ast-test-case/<test-case-name>/index.html`
65+
2. npm run updateSnapshot
66+
3. check outputs
67+
5568
## Contributing
5669

5770
1. Fork it!

example/.github/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- 'Type: Meta'
5+
- 'Type: Question'
6+
- 'Type: Release'
7+
8+
categories:
9+
- title: Security Fixes
10+
labels: ['Type: Security']
11+
- title: Breaking Changes
12+
labels: ['Type: Breaking Change']
13+
- title: Features
14+
labels: ['Type: Feature']
15+
- title: Bug Fixes
16+
labels: ['Type: Bug']
17+
- title: Documentation
18+
labels: ['Type: Documentation']
19+
- title: Refactoring
20+
labels: ['Type: Refactoring']
21+
- title: Testing
22+
labels: ['Type: Testing']
23+
- title: Maintenance
24+
labels: ['Type: Maintenance']
25+
- title: CI
26+
labels: ['Type: CI']
27+
- title: Dependency Updates
28+
labels: ['Type: Dependencies', "dependencies"]
29+
- title: Other Changes
30+
labels: ['*']

example/.textlintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": [
3+
"html"
4+
],
5+
"filters": {},
6+
"rules": {
7+
"preset-ja-technical-writing": {
8+
"ja-no-mixed-period": false
9+
}
10+
}
11+
}

example/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"private": true,
3+
"name": "example",
4+
"version": "1.0.0",
5+
"description": "",
6+
"main": "index.js",
7+
"scripts": {
8+
"test": "textlint test/ -f pretty-error || exit 0"
9+
},
10+
"workspaces": [
11+
"../"
12+
],
13+
"author": "azu",
14+
"license": "MIT",
15+
"devDependencies": {
16+
"textlint": "^13.0.5",
17+
"textlint-rule-preset-ja-technical-writing": "^7.0.0",
18+
"textlint-plugin-html": "^0.3.0"
19+
}
20+
}

0 commit comments

Comments
 (0)