@r_masseater/textlint-rule-preset-ja 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +166 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -17
package/README.md
CHANGED
|
@@ -21,4 +21,4 @@ npm install --save-dev textlint @r_masseater/textlint-rule-preset-ja @r_masseate
|
|
|
21
21
|
|
|
22
22
|
## Agent skills
|
|
23
23
|
|
|
24
|
-
The package ships
|
|
24
|
+
The package ships agent skills in `skills/`. Add `permissions: { "@r_masseater/textlint-rule-preset-ja": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
|
package/dist/index.d.mts
CHANGED
|
@@ -74,8 +74,9 @@ type TxtNodeType = keyof typeof ASTNodeTypes;
|
|
|
74
74
|
*/
|
|
75
75
|
type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* A position in the document text.
|
|
78
|
+
* `line` starts with 1, and `column` starts with 0 and counts UTF-16 code units.
|
|
79
|
+
* The character after a line ending is at column 0 of the next line.
|
|
79
80
|
* This is for compatibility with JavaScript AST.
|
|
80
81
|
* https://gist.github.com/azu/8866b2cb9b7a933e01fe
|
|
81
82
|
*/
|
|
@@ -84,22 +85,36 @@ type TxtNodePosition = {
|
|
|
84
85
|
readonly column: number;
|
|
85
86
|
};
|
|
86
87
|
/**
|
|
87
|
-
* Location
|
|
88
|
+
* Location.
|
|
89
|
+
* `start` is the position of `range[0]`, and `end` is the position of `range[1]`.
|
|
88
90
|
*/
|
|
89
91
|
type TxtNodeLocation = {
|
|
90
92
|
readonly start: TxtNodePosition;
|
|
91
93
|
readonly end: TxtNodePosition;
|
|
92
94
|
};
|
|
93
95
|
/**
|
|
94
|
-
* Range
|
|
96
|
+
* Range is a pair of offsets in the document text.
|
|
97
|
+
* `startIndex` is inclusive and `endIndex` is exclusive.
|
|
98
|
+
* Offsets start with 0 and count UTF-16 code units.
|
|
95
99
|
*/
|
|
96
100
|
type TxtNodeRange = readonly [startIndex: number, endIndex: number];
|
|
97
101
|
/**
|
|
98
102
|
* TxtNode is abstract interface of AST Node.
|
|
99
103
|
* Probably, Real TxtNode implementation has more properties.
|
|
104
|
+
*
|
|
105
|
+
* These type definitions are the definition of the generic nodes of TxtAST.
|
|
106
|
+
* A property marked as optional with `?` may be absent, `undefined`, or `null`.
|
|
107
|
+
* Every other property is required in every format.
|
|
100
108
|
*/
|
|
101
109
|
interface TxtNode {
|
|
110
|
+
/**
|
|
111
|
+
* Name of the node type.
|
|
112
|
+
* A generic node type is PascalCase. A node type that a format adds starts with a lowercase letter.
|
|
113
|
+
*/
|
|
102
114
|
readonly type: TxtNodeType;
|
|
115
|
+
/**
|
|
116
|
+
* Source text of the node. It is the document text from `range[0]` to `range[1]`.
|
|
117
|
+
*/
|
|
103
118
|
readonly raw: string;
|
|
104
119
|
readonly range: TxtNodeRange;
|
|
105
120
|
readonly loc: TxtNodeLocation;
|
|
@@ -111,6 +126,10 @@ interface TxtNode {
|
|
|
111
126
|
* For example, `Str` Node is an TxtTextNode.
|
|
112
127
|
*/
|
|
113
128
|
interface TxtTextNode extends TxtNode {
|
|
129
|
+
/**
|
|
130
|
+
* Content of the node without the markup, so it may differ from `raw`.
|
|
131
|
+
* Each text node type states what `value` holds.
|
|
132
|
+
*/
|
|
114
133
|
readonly value: string;
|
|
115
134
|
}
|
|
116
135
|
/**
|
|
@@ -118,9 +137,19 @@ interface TxtTextNode extends TxtNode {
|
|
|
118
137
|
* Parent Node has children that are consist of TxtParentNode or TxtTextNode
|
|
119
138
|
*/
|
|
120
139
|
interface TxtParentNode extends TxtNode {
|
|
140
|
+
/**
|
|
141
|
+
* Child nodes in the source order. It may be empty.
|
|
142
|
+
*/
|
|
121
143
|
readonly children: readonly Content[];
|
|
122
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Alignment of a table column. `null` means that the column has no alignment.
|
|
147
|
+
*/
|
|
123
148
|
type AlignType = "left" | "right" | "center" | null;
|
|
149
|
+
/**
|
|
150
|
+
* How a reference points to its `Definition`.
|
|
151
|
+
* In Markdown, `[text][label]` is "full", `[label][]` is "collapsed", and `[label]` is "shortcut".
|
|
152
|
+
*/
|
|
124
153
|
type ReferenceType = "shortcut" | "collapsed" | "full";
|
|
125
154
|
type Content = TopLevelContent | ListContent | TableContent | RowContent | PhrasingContent;
|
|
126
155
|
/**
|
|
@@ -131,7 +160,7 @@ type TopLevelContent = BlockContent;
|
|
|
131
160
|
* All node types that may be used where markdown block content is accepted.
|
|
132
161
|
* These types are accepted inside block quotes, list items, and roots.
|
|
133
162
|
*/
|
|
134
|
-
type BlockContent = TxtParagraphNode | TxtHeaderNode | TxtHorizontalRuleNode | TxtBlockQuoteNode | TxtListNode | TxtTableNode | TxtHtmlNode | TxtCodeBlockNode;
|
|
163
|
+
type BlockContent = TxtParagraphNode | TxtHeaderNode | TxtHorizontalRuleNode | TxtBlockQuoteNode | TxtListNode | TxtTableNode | TxtHtmlNode | TxtCodeBlockNode | TxtDefinitionNode;
|
|
135
164
|
/**
|
|
136
165
|
* All node types that are acceptable inside lists.
|
|
137
166
|
*/
|
|
@@ -147,116 +176,246 @@ type RowContent = TxtTableCellNode;
|
|
|
147
176
|
/**
|
|
148
177
|
* All node types that are acceptable in a (interactive) phrasing context (so not in links).
|
|
149
178
|
*/
|
|
150
|
-
type PhrasingContent = TxtLinkNode | StaticPhrasingContent;
|
|
179
|
+
type PhrasingContent = TxtLinkNode | TxtLinkReferenceNode | StaticPhrasingContent;
|
|
151
180
|
/**
|
|
152
181
|
* All node types that are acceptable in a static phrasing context.
|
|
153
182
|
*/
|
|
154
|
-
type StaticPhrasingContent = TxtStrNode | TxtEmphasisNode | TxtStrongNode | TxtDeleteNode | TxtHtmlNode | TxtCodeNode | TxtBreakNode | TxtImageNode | TxtCommentNode;
|
|
183
|
+
type StaticPhrasingContent = TxtStrNode | TxtEmphasisNode | TxtStrongNode | TxtDeleteNode | TxtHtmlNode | TxtCodeNode | TxtBreakNode | TxtImageNode | TxtImageReferenceNode | TxtCommentNode;
|
|
184
|
+
/**
|
|
185
|
+
* The whole document. It is the root of the AST.
|
|
186
|
+
*/
|
|
155
187
|
interface TxtDocumentNode extends TxtParentNode {
|
|
156
188
|
readonly type: "Document";
|
|
157
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* A paragraph.
|
|
192
|
+
*/
|
|
158
193
|
interface TxtParagraphNode extends TxtParentNode {
|
|
159
194
|
readonly type: "Paragraph";
|
|
160
195
|
readonly children: readonly PhrasingContent[];
|
|
161
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* A heading.
|
|
199
|
+
*/
|
|
162
200
|
interface TxtHeaderNode extends TxtParentNode {
|
|
163
201
|
readonly type: "Header";
|
|
202
|
+
/**
|
|
203
|
+
* Level of the heading. 1 is the top level.
|
|
204
|
+
*/
|
|
164
205
|
readonly depth: 1 | 2 | 3 | 4 | 5 | 6;
|
|
165
206
|
readonly children: readonly PhrasingContent[];
|
|
166
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* A thematic break.
|
|
210
|
+
*/
|
|
167
211
|
interface TxtHorizontalRuleNode extends TxtNode {
|
|
168
212
|
readonly type: "HorizontalRule";
|
|
169
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* A quotation of blocks.
|
|
216
|
+
*/
|
|
170
217
|
interface TxtBlockQuoteNode extends TxtParentNode {
|
|
171
218
|
readonly type: "BlockQuote";
|
|
172
219
|
readonly children: readonly BlockContent[];
|
|
173
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* A list. Its children are `ListItem`.
|
|
223
|
+
*/
|
|
174
224
|
interface TxtListNode extends TxtParentNode {
|
|
175
225
|
readonly type: "List";
|
|
226
|
+
/**
|
|
227
|
+
* Whether the items are ordered.
|
|
228
|
+
*/
|
|
176
229
|
readonly ordered?: boolean | null | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Number of the first item of an ordered list.
|
|
232
|
+
*/
|
|
177
233
|
readonly start?: number | null | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* Whether any of the items are separated by blank lines.
|
|
236
|
+
*/
|
|
178
237
|
readonly spread?: boolean | null | undefined;
|
|
179
238
|
readonly children: readonly ListContent[];
|
|
180
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* An item of a list.
|
|
242
|
+
*/
|
|
181
243
|
interface TxtListItemNode extends TxtParentNode {
|
|
182
244
|
readonly type: "ListItem";
|
|
245
|
+
/**
|
|
246
|
+
* `true` or `false` for a task list item. `null` or absent for other items.
|
|
247
|
+
*/
|
|
183
248
|
readonly checked?: boolean | null | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the item contains blocks separated by blank lines.
|
|
251
|
+
*/
|
|
184
252
|
readonly spread?: boolean | null | undefined;
|
|
185
253
|
readonly children: readonly BlockContent[];
|
|
186
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* A table. Its children are `TableRow`.
|
|
257
|
+
*/
|
|
187
258
|
interface TxtTableNode extends TxtParentNode {
|
|
188
259
|
readonly type: "Table";
|
|
260
|
+
/**
|
|
261
|
+
* Alignment of each column.
|
|
262
|
+
*/
|
|
189
263
|
readonly align?: readonly AlignType[] | null | undefined;
|
|
190
264
|
readonly children: readonly TableContent[];
|
|
191
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* A row of a table. Its children are `TableCell`.
|
|
268
|
+
*/
|
|
192
269
|
interface TxtTableRowNode extends TxtParentNode {
|
|
193
270
|
readonly type: "TableRow";
|
|
194
271
|
readonly children: readonly RowContent[];
|
|
195
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* A cell of a table.
|
|
275
|
+
*/
|
|
196
276
|
interface TxtTableCellNode extends TxtParentNode {
|
|
197
277
|
readonly type: "TableCell";
|
|
198
278
|
readonly children: readonly PhrasingContent[];
|
|
199
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Raw HTML, as a block or inline. `value` is the HTML.
|
|
282
|
+
*/
|
|
200
283
|
interface TxtHtmlNode extends TxtTextNode {
|
|
201
284
|
readonly type: "Html";
|
|
202
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* A comment of the format. `value` is the content of the comment.
|
|
288
|
+
*/
|
|
203
289
|
interface TxtCommentNode extends TxtTextNode {
|
|
204
290
|
readonly type: "Comment";
|
|
205
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* A block of code. `value` is the code.
|
|
294
|
+
*/
|
|
206
295
|
interface TxtCodeBlockNode extends TxtTextNode {
|
|
207
296
|
readonly type: "CodeBlock";
|
|
297
|
+
/**
|
|
298
|
+
* Language of the code.
|
|
299
|
+
*/
|
|
208
300
|
readonly lang?: string | null | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* Additional information that follows the language.
|
|
303
|
+
*/
|
|
209
304
|
readonly meta?: string | null | undefined;
|
|
210
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Prose. `value` is the text that rules check.
|
|
308
|
+
* Markup becomes other nodes, and a parser does not split `Str` into sentences or words.
|
|
309
|
+
*/
|
|
211
310
|
interface TxtStrNode extends TxtTextNode {
|
|
212
311
|
readonly type: "Str";
|
|
213
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Emphasis.
|
|
315
|
+
*/
|
|
214
316
|
interface TxtEmphasisNode extends TxtParentNode {
|
|
215
317
|
readonly type: "Emphasis";
|
|
216
318
|
readonly children: readonly PhrasingContent[];
|
|
217
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Strong emphasis.
|
|
322
|
+
*/
|
|
218
323
|
interface TxtStrongNode extends TxtParentNode {
|
|
219
324
|
readonly type: "Strong";
|
|
220
325
|
readonly children: readonly PhrasingContent[];
|
|
221
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Deleted text.
|
|
329
|
+
*/
|
|
222
330
|
interface TxtDeleteNode extends TxtParentNode {
|
|
223
331
|
readonly type: "Delete";
|
|
224
332
|
readonly children: readonly PhrasingContent[];
|
|
225
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Inline code. `value` is the code.
|
|
336
|
+
*/
|
|
226
337
|
interface TxtCodeNode extends TxtTextNode {
|
|
227
338
|
readonly type: "Code";
|
|
228
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* A hard line break.
|
|
342
|
+
*/
|
|
229
343
|
interface TxtBreakNode extends TxtNode {
|
|
230
344
|
readonly type: "Break";
|
|
231
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* A link.
|
|
348
|
+
*/
|
|
232
349
|
interface TxtLinkNode extends TxtParentNode, TxtResource {
|
|
233
350
|
readonly type: "Link";
|
|
234
351
|
readonly children: readonly StaticPhrasingContent[];
|
|
235
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* A link that points to a `Definition`.
|
|
355
|
+
*/
|
|
236
356
|
interface TxtLinkReferenceNode extends TxtParentNode, TxtReference {
|
|
237
357
|
readonly type: "LinkReference";
|
|
238
358
|
readonly children: readonly StaticPhrasingContent[];
|
|
359
|
+
/**
|
|
360
|
+
* How the reference is written.
|
|
361
|
+
*/
|
|
239
362
|
readonly referenceType: ReferenceType;
|
|
240
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* An image.
|
|
366
|
+
*/
|
|
241
367
|
interface TxtImageNode extends TxtNode, TxtResource, TxtAlternative {
|
|
242
368
|
readonly type: "Image";
|
|
243
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* An image that points to a `Definition`.
|
|
372
|
+
*/
|
|
244
373
|
interface TxtImageReferenceNode extends TxtNode, TxtAlternative, TxtReference {
|
|
245
374
|
readonly type: "ImageReference";
|
|
375
|
+
/**
|
|
376
|
+
* How the reference is written.
|
|
377
|
+
*/
|
|
246
378
|
readonly referenceType: ReferenceType;
|
|
247
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* A definition that a reference points to.
|
|
382
|
+
*/
|
|
248
383
|
interface TxtDefinitionNode extends TxtNode, TxtResource, TxtReference {
|
|
249
384
|
readonly type: "Definition";
|
|
250
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* A node that refers to a resource.
|
|
388
|
+
*/
|
|
251
389
|
interface TxtResource {
|
|
390
|
+
/**
|
|
391
|
+
* Location of the resource.
|
|
392
|
+
*/
|
|
252
393
|
readonly url: string;
|
|
394
|
+
/**
|
|
395
|
+
* Title of the resource.
|
|
396
|
+
*/
|
|
253
397
|
readonly title?: string | null | undefined;
|
|
254
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* A node that has an alternative text.
|
|
401
|
+
*/
|
|
255
402
|
interface TxtAlternative {
|
|
403
|
+
/**
|
|
404
|
+
* Text that describes the image.
|
|
405
|
+
*/
|
|
256
406
|
readonly alt?: string | null | undefined;
|
|
257
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* A node that is matched with another node by an identifier.
|
|
410
|
+
*/
|
|
258
411
|
interface TxtReference {
|
|
412
|
+
/**
|
|
413
|
+
* Normalized form of `label`. A reference and its `Definition` have the same `identifier`.
|
|
414
|
+
*/
|
|
259
415
|
readonly identifier: string;
|
|
416
|
+
/**
|
|
417
|
+
* Label as written in the document.
|
|
418
|
+
*/
|
|
260
419
|
readonly label: string;
|
|
261
420
|
}
|
|
262
421
|
/**
|