You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: improve textlint-website-generator README with comprehensive usage instructions (#114)
- Add clear overview and features section
- Expand usage examples from basic to advanced
- Document all CLI options with detailed explanations
- Add 'How It Works' technical explanation
- Include configuration details for package.json and .textlintrc
- Document project structure for developers
- Add integration notes for textlint-editor browser extension
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/@textlint/website-generator/README.md
+118-6Lines changed: 118 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,19 @@
1
1
# @textlint/website-generator
2
2
3
-
Website generator using @textlint/script-compiler
3
+
A website generator that creates a standalone web application for textlint, allowing users to lint text directly in the browser using your configured textlint rules.
4
+
5
+
## Overview
6
+
7
+
`@textlint/website-generator` compiles your textlint configuration and rules into a web worker script and generates a complete website with an interactive text editor. This enables users to experience your textlint rules without any installation.
8
+
9
+
## Features
10
+
11
+
- Generates a standalone website with textlint functionality
12
+
- Compiles textlint rules to run in web workers
13
+
- Creates an interactive text editor with real-time linting
14
+
- Supports custom styling with title and placeholder text
15
+
- Works with existing `.textlintrc` configuration files
16
+
- Automatically infers metadata from `package.json`
4
17
5
18
## Install
6
19
@@ -10,6 +23,16 @@ Install with [npm](https://www.npmjs.com/):
10
23
11
24
## Usage
12
25
26
+
### Basic Usage
27
+
28
+
Generate a website using your existing `.textlintrc` configuration:
29
+
30
+
```bash
31
+
textlint-website-generator --output-dir ./dist
32
+
```
33
+
34
+
### Command Line Options
35
+
13
36
Usage
14
37
$ textlint-website-generator
15
38
@@ -18,13 +41,102 @@ Install with [npm](https://www.npmjs.com/):
18
41
--placeholder [String] Placeholder text in generated website
19
42
--cwd current working directory
20
43
--textlintrc [path:String] path to .textlintrc file. Default: load .textlintrc.{json,yaml,js}
21
-
--output-dir [path:String] output file path that is written of reported result.
1.**Compilation**: The generator uses `@textlint/script-compiler` to compile your textlint configuration and rules into a web worker script (`textlint-worker.js`)
71
+
72
+
2.**Template Generation**: It creates an HTML page with:
73
+
- An interactive textarea for text input
74
+
- Integration with `textchecker-element` for real-time linting
75
+
- Support for the textlint-editor browser extension
76
+
77
+
3.**Output**: The generator produces:
78
+
-`index.html` - The main webpage
79
+
-`textlint-worker.js` - Compiled textlint rules as a web worker
80
+
-`textchecker-element.esm.js` - UI component for text checking
81
+
82
+
## Configuration
83
+
84
+
### Using package.json
85
+
86
+
By default, the generator reads metadata from your `package.json`:
The package includes a script to generate the template files:
115
+
116
+
```bash
117
+
npm run generate-template
118
+
```
119
+
120
+
This runs before packaging to ensure the latest template is included.
121
+
122
+
### Project Structure
123
+
124
+
```
125
+
packages/@textlint/website-generator/
126
+
├── bin/
127
+
│ └── cmd.js # CLI entry point
128
+
├── src/
129
+
│ ├── cli.ts # CLI implementation
130
+
│ └── website-generator.ts # Core generator logic
131
+
├── template/
132
+
│ ├── index.html # HTML template
133
+
│ └── textchecker-element.esm.js # UI component
134
+
└── lib/ # Compiled JavaScript output
135
+
```
136
+
137
+
## Integration with textlint-editor
138
+
139
+
The generated website can work with the [textlint-editor browser extension](https://github.com/textlint/editor) for enhanced functionality. Users can install custom rule scripts using the "Install" button on the generated page.
0 commit comments