@markuplint/html-spec 4.16.1 → 5.0.0-alpha.0
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/ARCHITECTURE.ja.md +285 -0
- package/ARCHITECTURE.md +202 -0
- package/CHANGELOG.md +38 -2
- package/README.md +11 -259
- package/SKILL.md +358 -0
- package/docs/build-pipeline.ja.md +170 -0
- package/docs/build-pipeline.md +171 -0
- package/docs/element-spec-format.ja.md +952 -0
- package/docs/element-spec-format.md +521 -0
- package/docs/maintenance.ja.md +359 -0
- package/docs/maintenance.md +397 -0
- package/index.json +19235 -5358
- package/package.json +9 -5
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# @markuplint/html-spec
|
|
2
|
+
|
|
3
|
+
## 概要
|
|
4
|
+
|
|
5
|
+
`@markuplint/html-spec` は HTML Living Standard のデータセットプロバイダです。TypeScript ソースコードを含まない純粋なデータパッケージであり、177 個の要素 JSON 仕様ファイルと 2 個の共通定義ファイルから構成されます。
|
|
6
|
+
|
|
7
|
+
ビルド時に `@markuplint/spec-generator` が外部ソース(MDN、W3C ARIA 1.1/1.2/1.3、HTML Living Standard、SVG 仕様)からデータをフェッチし、手動で管理されたローカル仕様とマージして、統合された `index.json`(48,000 行以上、約 1.4MB)を生成します。手動データは常に外部データより優先され、仕様の正確性を保証します。
|
|
8
|
+
|
|
9
|
+
## ディレクトリ構成
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/
|
|
13
|
+
├── spec.a.jsonc # <a> 要素の仕様
|
|
14
|
+
├── spec.abbr.jsonc # <abbr> 要素の仕様
|
|
15
|
+
├── ... (計 177 個の要素仕様ファイル)
|
|
16
|
+
├── spec.svg_text.jsonc # <svg:text> 要素の仕様
|
|
17
|
+
├── spec-common.attributes.jsonc # 19 個のグローバル属性カテゴリ定義
|
|
18
|
+
└── spec-common.contents.jsonc # HTML 10 + SVG 19 のコンテンツモデルカテゴリ定義
|
|
19
|
+
|
|
20
|
+
build.mjs # @markuplint/spec-generator を呼び出すビルドスクリプト
|
|
21
|
+
index.json # 生成出力(48K 行以上、編集不可)
|
|
22
|
+
index.js # CommonJS エントリーポイント
|
|
23
|
+
index.d.ts # TypeScript 型宣言
|
|
24
|
+
test/
|
|
25
|
+
└── structure.spec.mjs # スキーマ検証テスト
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## アーキテクチャ図
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
flowchart TD
|
|
32
|
+
subgraph sources ["ソースデータ"]
|
|
33
|
+
specFiles["src/spec.*.jsonc\n(177 個の要素仕様)"]
|
|
34
|
+
commonAttrs["src/spec-common.attributes.jsonc\n(19 グローバル属性カテゴリ)"]
|
|
35
|
+
commonContents["src/spec-common.contents.jsonc\n(HTML 10 + SVG 19 コンテンツモデル)"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
subgraph build ["ビルドパイプライン"]
|
|
39
|
+
buildMjs["build.mjs"]
|
|
40
|
+
specGen["@markuplint/spec-generator\nmain()"]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
subgraph external ["外部データソース"]
|
|
44
|
+
mdn["MDN Web Docs"]
|
|
45
|
+
aria["W3C ARIA\n(1.1 / 1.2 / 1.3)"]
|
|
46
|
+
htmlLs["HTML Living Standard"]
|
|
47
|
+
svg["SVG 仕様"]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
subgraph output ["生成出力"]
|
|
51
|
+
indexJson["index.json\n(48K+ 行、統合データセット)"]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
subgraph consumers ["利用パッケージ"]
|
|
55
|
+
mlCore["@markuplint/ml-core"]
|
|
56
|
+
rules["@markuplint/rules"]
|
|
57
|
+
mlSpec["@markuplint/ml-spec"]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
specFiles --> buildMjs
|
|
61
|
+
commonAttrs --> buildMjs
|
|
62
|
+
commonContents --> buildMjs
|
|
63
|
+
buildMjs --> specGen
|
|
64
|
+
|
|
65
|
+
mdn --> specGen
|
|
66
|
+
aria --> specGen
|
|
67
|
+
htmlLs --> specGen
|
|
68
|
+
svg --> specGen
|
|
69
|
+
|
|
70
|
+
specGen -->|"手動データ優先で\n外部データとマージ"| indexJson
|
|
71
|
+
|
|
72
|
+
indexJson --> mlSpec
|
|
73
|
+
indexJson --> mlCore
|
|
74
|
+
indexJson --> rules
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## データ構造
|
|
78
|
+
|
|
79
|
+
`index.json` は 3 つのトップレベルキーで構成されます。
|
|
80
|
+
|
|
81
|
+
### `cites`
|
|
82
|
+
|
|
83
|
+
生成プロセス中にフェッチされた全 URL のソート済みリストです。データの出所を追跡するために使用されます。
|
|
84
|
+
|
|
85
|
+
### `def`
|
|
86
|
+
|
|
87
|
+
グローバル定義を格納するオブジェクトです。
|
|
88
|
+
|
|
89
|
+
| キー | 内容 |
|
|
90
|
+
| ---------------- | -------------------------------------------------------------------- |
|
|
91
|
+
| `#globalAttrs` | 19 個のグローバル属性カテゴリ(`#HTMLGlobalAttrs` 等) |
|
|
92
|
+
| `#aria` | バージョン別 ARIA 定義(1.1, 1.2, 1.3) |
|
|
93
|
+
| `#contentModels` | コンテンツモデルカテゴリマクロ(HTML 10 カテゴリ + SVG 19 カテゴリ) |
|
|
94
|
+
|
|
95
|
+
### `specs`
|
|
96
|
+
|
|
97
|
+
全要素仕様の配列です。各要素は `contentModel`、`globalAttrs`、`attributes`、`aria` などのフィールドを持ちます。
|
|
98
|
+
|
|
99
|
+
TypeScript 型は `index.d.ts` で以下のように宣言されます。
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import type { Cites, ElementSpec, SpecDefs } from '@markuplint/ml-spec';
|
|
103
|
+
|
|
104
|
+
declare const json: {
|
|
105
|
+
cites: Cites;
|
|
106
|
+
def: SpecDefs;
|
|
107
|
+
specs: ElementSpec[];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export = json;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 主要コンポーネント
|
|
114
|
+
|
|
115
|
+
| コンポーネント | ファイル | 説明 |
|
|
116
|
+
| -------------- | --------------------------------------- | ------------------------------------------------------------- |
|
|
117
|
+
| ソース仕様 | `src/spec.*.jsonc`(177 ファイル) | 要素ごとの仕様定義(コンテンツモデル、属性、ARIA マッピング) |
|
|
118
|
+
| 共通定義 | `src/spec-common.*.jsonc`(2 ファイル) | グローバル属性カテゴリとコンテンツモデルマクロの共有定義 |
|
|
119
|
+
| ビルドシステム | `build.mjs` | `@markuplint/spec-generator` の `main()` を呼び出すエントリー |
|
|
120
|
+
| 生成出力 | `index.json` | 統合データセット(48K 行以上、直接編集不可) |
|
|
121
|
+
| 型宣言 | `index.d.ts` | `@markuplint/ml-spec` からの型を再エクスポート |
|
|
122
|
+
| スキーマ検証 | `test/structure.spec.mjs` | Ajv ベースの JSON スキーマ検証テスト |
|
|
123
|
+
|
|
124
|
+
## 要素仕様のフォーマット
|
|
125
|
+
|
|
126
|
+
各 `src/spec.*.jsonc` ファイルは以下の構造を持ちます(例: `spec.a.jsonc`)。
|
|
127
|
+
|
|
128
|
+
```jsonc
|
|
129
|
+
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
|
|
130
|
+
{
|
|
131
|
+
"contentModel": {
|
|
132
|
+
"contents": [
|
|
133
|
+
{
|
|
134
|
+
"transparent": ":not(:model(interactive), a, [tabindex])"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"globalAttrs": {
|
|
139
|
+
"#HTMLGlobalAttrs": true,
|
|
140
|
+
"#GlobalEventAttrs": true,
|
|
141
|
+
"#ARIAAttrs": true,
|
|
142
|
+
"#HTMLLinkAndFetchingAttrs": ["href", "target", "download", "ping", "rel", "hreflang", "type", "referrerpolicy"]
|
|
143
|
+
},
|
|
144
|
+
"attributes": {},
|
|
145
|
+
"aria": {
|
|
146
|
+
"implicitRole": "link",
|
|
147
|
+
"permittedRoles": ["button", "checkbox", "menuitem", ...],
|
|
148
|
+
"properties": { ... },
|
|
149
|
+
"conditions": { ... }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
主要フィールドの説明:
|
|
155
|
+
|
|
156
|
+
| フィールド | 説明 |
|
|
157
|
+
| -------------- | --------------------------------------------------------------------------- |
|
|
158
|
+
| `contentModel` | 許可される子要素のパターン定義 |
|
|
159
|
+
| `globalAttrs` | 使用するグローバル属性カテゴリのマッピング(`true` で全属性、配列で選択的) |
|
|
160
|
+
| `attributes` | 要素固有の属性定義 |
|
|
161
|
+
| `aria` | ARIA マッピング(暗黙ロール、許可ロール、プロパティ、条件分岐) |
|
|
162
|
+
|
|
163
|
+
## 共通定義ファイル
|
|
164
|
+
|
|
165
|
+
### `spec-common.attributes.jsonc`
|
|
166
|
+
|
|
167
|
+
19 個のグローバル属性カテゴリを定義します。カテゴリキーは `#` プレフィックスで参照されます。
|
|
168
|
+
|
|
169
|
+
| カテゴリキー | 内容 |
|
|
170
|
+
| --------------------------- | -------------------------------------------------- |
|
|
171
|
+
| `#HTMLGlobalAttrs` | `accesskey`, `contenteditable`, `dir` 等の標準属性 |
|
|
172
|
+
| `#GlobalEventAttrs` | `onclick`, `onload` 等のイベントハンドラ属性 |
|
|
173
|
+
| `#ARIAAttrs` | `aria-*` 属性群 |
|
|
174
|
+
| `#HTMLLinkAndFetchingAttrs` | `href`, `target`, `download` 等のリンク関連属性 |
|
|
175
|
+
|
|
176
|
+
### `spec-common.contents.jsonc`
|
|
177
|
+
|
|
178
|
+
コンテンツモデルカテゴリのマクロ定義です。
|
|
179
|
+
|
|
180
|
+
- **HTML カテゴリ**(10 個): `#metadata`, `#flow`, `#sectioning`, `#heading`, `#phrasing`, `#embedded`, `#interactive`, `#palpable`, `#scriptSupporting`, `#formAssociated`
|
|
181
|
+
- **SVG カテゴリ**(19 個): `#SVGAnimation`, `#SVGDescriptive`, `#SVGShape`, `#SVGStructural` 等
|
|
182
|
+
|
|
183
|
+
## ビルドパイプライン
|
|
184
|
+
|
|
185
|
+
ビルドは `build.mjs` を通じて `@markuplint/spec-generator` の `main()` 関数を呼び出します。
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
import path from 'node:path';
|
|
189
|
+
import { main } from '@markuplint/spec-generator';
|
|
190
|
+
|
|
191
|
+
await main({
|
|
192
|
+
outputFilePath: path.resolve(import.meta.dirname, 'index.json'),
|
|
193
|
+
htmlFilePattern: path.resolve(import.meta.dirname, 'src', 'spec.*.jsonc'),
|
|
194
|
+
commonAttrsFilePath: path.resolve(import.meta.dirname, 'src', 'spec-common.attributes.jsonc'),
|
|
195
|
+
commonContentsFilePath: path.resolve(import.meta.dirname, 'src', 'spec-common.contents.jsonc'),
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
ビルドプロセスの流れ:
|
|
200
|
+
|
|
201
|
+
1. `src/spec.*.jsonc` と `src/spec-common.*.jsonc` を読み込む
|
|
202
|
+
2. MDN、W3C ARIA(1.1/1.2/1.3)、HTML Living Standard、SVG 仕様から外部データをフェッチ
|
|
203
|
+
3. 手動仕様と外部データをマージ(手動データが優先)
|
|
204
|
+
4. 統合された `index.json` を出力
|
|
205
|
+
|
|
206
|
+
ビルドコマンド:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# 生成 + フォーマット
|
|
210
|
+
yarn gen
|
|
211
|
+
|
|
212
|
+
# 生成のみ
|
|
213
|
+
yarn gen:build
|
|
214
|
+
|
|
215
|
+
# フォーマットのみ
|
|
216
|
+
yarn gen:prettier
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## テスト
|
|
220
|
+
|
|
221
|
+
`test/structure.spec.mjs` は以下の検証を行います。
|
|
222
|
+
|
|
223
|
+
1. **構造テスト**: 全要素仕様に対して `resolveNamespace()` と `getAttrSpecsByNames()` を呼び出し、属性仕様の整合性を確認
|
|
224
|
+
2. **スキーマ検証**: Ajv を使用して各ソース JSON ファイルが `@markuplint/ml-spec` の JSON スキーマに適合することを検証
|
|
225
|
+
- `spec.*.jsonc` → `element.schema.json`(+ 関連スキーマ)
|
|
226
|
+
- `spec-common.attributes.jsonc` → `global-attributes.schema.json`
|
|
227
|
+
|
|
228
|
+
## 外部依存パッケージ
|
|
229
|
+
|
|
230
|
+
| パッケージ | 種別 | 用途 |
|
|
231
|
+
| ---------------------------- | ---- | -------------------------------------------- |
|
|
232
|
+
| `@markuplint/ml-spec` | 本番 | 型定義(`Cites`, `ElementSpec`, `SpecDefs`) |
|
|
233
|
+
| `@markuplint/spec-generator` | 開発 | ビルドパイプライン |
|
|
234
|
+
| `@markuplint/test-tools` | 開発 | テストユーティリティ(`glob` 等) |
|
|
235
|
+
|
|
236
|
+
## 他パッケージとの連携
|
|
237
|
+
|
|
238
|
+
```mermaid
|
|
239
|
+
flowchart LR
|
|
240
|
+
subgraph upstream ["上流パッケージ"]
|
|
241
|
+
specGen["@markuplint/spec-generator\n(ビルドパイプライン)"]
|
|
242
|
+
mlSpecTypes["@markuplint/ml-spec\n(型定義)"]
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
subgraph pkg ["@markuplint/html-spec"]
|
|
246
|
+
sourceData["ソース仕様\n(177 JSON + 2 共通)"]
|
|
247
|
+
buildScript["build.mjs"]
|
|
248
|
+
generatedJson["index.json"]
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
subgraph downstream ["下流パッケージ"]
|
|
252
|
+
mlSpec["@markuplint/ml-spec\n(アルゴリズム)"]
|
|
253
|
+
mlCore["@markuplint/ml-core"]
|
|
254
|
+
rules["@markuplint/rules"]
|
|
255
|
+
fwSpecs["フレームワーク仕様パッケージ\n(vue-spec, react-spec 等)"]
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
mlSpecTypes -->|"型定義\n(index.d.ts)"| pkg
|
|
259
|
+
specGen -->|"main()\n(ビルド時)"| buildScript
|
|
260
|
+
sourceData --> buildScript
|
|
261
|
+
buildScript --> generatedJson
|
|
262
|
+
|
|
263
|
+
generatedJson -->|"MLMLSpec JSON\n(ベースデータ)"| mlSpec
|
|
264
|
+
generatedJson -->|"要素仕様\nARIA 定義"| mlCore
|
|
265
|
+
generatedJson -->|"リントルール\nの参照データ"| rules
|
|
266
|
+
generatedJson -->|"拡張のベース"| fwSpecs
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### 上流
|
|
270
|
+
|
|
271
|
+
- **`@markuplint/ml-spec`** は `index.d.ts` で使用される型定義(`Cites`, `ElementSpec`, `SpecDefs`)を提供します。
|
|
272
|
+
- **`@markuplint/spec-generator`** はビルド時に外部仕様のフェッチとデータ統合を担当します。
|
|
273
|
+
|
|
274
|
+
### 下流
|
|
275
|
+
|
|
276
|
+
- **`@markuplint/ml-spec`** は生成された `index.json` をベース `MLMLSpec` データとして読み込み、ARIA/HTML アルゴリズムに供給します。
|
|
277
|
+
- **`@markuplint/ml-core`** は要素仕様と ARIA 定義を使用して、仕様認識を持つドキュメント表現を構築します。
|
|
278
|
+
- **`@markuplint/rules`** は仕様データを参照してリントルール(ロール検証、コンテンツモデルチェック等)を実装します。
|
|
279
|
+
- **フレームワーク仕様パッケージ**(`@markuplint/vue-spec`, `@markuplint/react-spec` 等)は `index.json` のデータをベースとして、フレームワーク固有の要素や属性を拡張します。
|
|
280
|
+
|
|
281
|
+
## ドキュメントマップ
|
|
282
|
+
|
|
283
|
+
- [要素仕様フォーマット](docs/element-spec-format.ja.md) -- 要素 JSON の構造、フィールド定義、条件分岐パターン
|
|
284
|
+
- [ビルドパイプライン](docs/build-pipeline.ja.md) -- spec-generator の動作、外部データフェッチ、マージ戦略
|
|
285
|
+
- [メンテナンスガイド](docs/maintenance.ja.md) -- 新規要素の追加、属性更新、外部仕様の変更対応
|
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# @markuplint/html-spec
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`@markuplint/html-spec` is the canonical HTML Living Standard dataset provider for markuplint. It is a pure data package with no TypeScript source code. It contains 177 per-element JSON specification files and 2 common definition files that are processed by `@markuplint/spec-generator` to produce a single consolidated `index.json` (48K+ lines, 1.4MB).
|
|
6
|
+
|
|
7
|
+
During the build, `@markuplint/spec-generator` fetches live data from MDN, W3C ARIA specifications (1.1, 1.2, 1.3), Graphics ARIA, DPub ARIA, HTML-ARIA mappings, the HTML Living Standard, and SVG specifications, then merges that external data with the hand-authored JSON files. Manual specifications always take precedence over fetched data, ensuring stable, curated definitions while still benefiting from automated enrichment.
|
|
8
|
+
|
|
9
|
+
## Directory Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/
|
|
13
|
+
├── spec.a.jsonc # <a> element specification
|
|
14
|
+
├── spec.abbr.jsonc # <abbr> element specification
|
|
15
|
+
├── ... (177 element specification files total)
|
|
16
|
+
├── spec.svg_text.jsonc # <svg:text> element specification
|
|
17
|
+
├── spec-common.attributes.jsonc # 19 global attribute category definitions
|
|
18
|
+
└── spec-common.contents.jsonc # 10 HTML + 19 SVG content model category definitions
|
|
19
|
+
|
|
20
|
+
build.mjs # Build script invoking @markuplint/spec-generator
|
|
21
|
+
index.json # Generated output (48K+ lines, DO NOT EDIT)
|
|
22
|
+
index.js # CommonJS entry point (re-exports index.json)
|
|
23
|
+
index.d.ts # TypeScript type declarations
|
|
24
|
+
test/
|
|
25
|
+
└── structure.spec.mjs # Schema validation tests
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Architecture Diagram
|
|
29
|
+
|
|
30
|
+
```mermaid
|
|
31
|
+
flowchart TD
|
|
32
|
+
subgraph sources ["Source Layer"]
|
|
33
|
+
elemSpecs["177 element specs\n(src/spec.*.jsonc)"]
|
|
34
|
+
commonAttrs["spec-common.attributes.jsonc\n(19 global attribute categories)"]
|
|
35
|
+
commonContents["spec-common.contents.jsonc\n(10 HTML + 19 SVG content models)"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
subgraph build ["Build Pipeline"]
|
|
39
|
+
buildScript["build.mjs"]
|
|
40
|
+
specGen["@markuplint/spec-generator\nmain()"]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
subgraph external ["External Data Sources"]
|
|
44
|
+
mdn["MDN Web Docs\n(compatibility, descriptions)"]
|
|
45
|
+
aria["W3C ARIA Specs\n(1.1 / 1.2 / 1.3)"]
|
|
46
|
+
graphicsAria["Graphics ARIA"]
|
|
47
|
+
dpubAria["DPub ARIA"]
|
|
48
|
+
htmlAria["HTML-ARIA Mappings"]
|
|
49
|
+
htmlLS["HTML Living Standard\n(elements, attributes)"]
|
|
50
|
+
svg["SVG Specification\n(elements, attributes)"]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
subgraph output ["Generated Output"]
|
|
54
|
+
indexJson["index.json\n(48K+ lines, 1.4MB)"]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
subgraph consumers ["Downstream Consumers"]
|
|
58
|
+
mlCore["@markuplint/ml-core"]
|
|
59
|
+
rules["@markuplint/rules"]
|
|
60
|
+
fwSpecs["Framework spec packages\n(vue-spec, react-spec, etc.)"]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
elemSpecs --> buildScript
|
|
64
|
+
commonAttrs --> buildScript
|
|
65
|
+
commonContents --> buildScript
|
|
66
|
+
buildScript --> specGen
|
|
67
|
+
|
|
68
|
+
mdn --> specGen
|
|
69
|
+
aria --> specGen
|
|
70
|
+
graphicsAria --> specGen
|
|
71
|
+
dpubAria --> specGen
|
|
72
|
+
htmlAria --> specGen
|
|
73
|
+
htmlLS --> specGen
|
|
74
|
+
svg --> specGen
|
|
75
|
+
|
|
76
|
+
specGen -->|"merge\n(manual takes precedence)"| indexJson
|
|
77
|
+
|
|
78
|
+
indexJson --> mlCore
|
|
79
|
+
indexJson --> rules
|
|
80
|
+
indexJson --> fwSpecs
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Data Structure
|
|
84
|
+
|
|
85
|
+
The generated `index.json` contains three top-level keys:
|
|
86
|
+
|
|
87
|
+
### `cites`
|
|
88
|
+
|
|
89
|
+
A sorted list of all URLs fetched during generation. This provides traceability for every external data source that contributed to the output.
|
|
90
|
+
|
|
91
|
+
### `def`
|
|
92
|
+
|
|
93
|
+
Global definitions shared across all element specifications.
|
|
94
|
+
|
|
95
|
+
| Key | Description |
|
|
96
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
97
|
+
| `#globalAttrs` | 19 global attribute categories defining attributes available on all or specific groups of elements |
|
|
98
|
+
| `#aria` | ARIA role and property definitions per specification version (1.1, 1.2, 1.3), plus Graphics ARIA and DPub ARIA roles |
|
|
99
|
+
| `#contentModels` | Content model category macros mapping category names to their member elements |
|
|
100
|
+
|
|
101
|
+
**Global Attribute Categories** (`#globalAttrs`):
|
|
102
|
+
|
|
103
|
+
| Category | Scope |
|
|
104
|
+
| ----------------------------------- | ------------------------------------- |
|
|
105
|
+
| `#HTMLGlobalAttrs` | HTML global attributes |
|
|
106
|
+
| `#GlobalEventAttrs` | Global event handler attributes |
|
|
107
|
+
| `#ARIAAttrs` | ARIA state and property attributes |
|
|
108
|
+
| `#HTMLLinkAndFetchingAttrs` | Link/fetch-related attributes |
|
|
109
|
+
| `#HTMLEmbededAndMediaContentAttrs` | Embedded and media content attributes |
|
|
110
|
+
| `#HTMLFormControlElementAttrs` | Form control attributes |
|
|
111
|
+
| `#HTMLTableCellElementAttrs` | Table cell attributes |
|
|
112
|
+
| `#SVGAnimationAdditionAttrs` | SVG animation addition attributes |
|
|
113
|
+
| `#SVGAnimationAttributeTargetAttrs` | SVG animation attribute target attrs |
|
|
114
|
+
| `#SVGAnimationEventAttrs` | SVG animation event attributes |
|
|
115
|
+
| `#SVGAnimationTargetElementAttrs` | SVG animation target element attrs |
|
|
116
|
+
| `#SVGAnimationTimingAttrs` | SVG animation timing attributes |
|
|
117
|
+
| `#SVGAnimationValueAttrs` | SVG animation value attributes |
|
|
118
|
+
| `#SVGConditionalProcessingAttrs` | SVG conditional processing attributes |
|
|
119
|
+
| `#SVGCoreAttrs` | SVG core attributes |
|
|
120
|
+
| `#SVGFilterPrimitiveAttrs` | SVG filter primitive attributes |
|
|
121
|
+
| `#SVGPresentationAttrs` | SVG presentation attributes |
|
|
122
|
+
| `#SVGTransferFunctionAttrs` | SVG transfer function attributes |
|
|
123
|
+
| `#XLinkAttrs` | XLink attributes |
|
|
124
|
+
|
|
125
|
+
**Content Model Categories** (`#contentModels`):
|
|
126
|
+
|
|
127
|
+
- **HTML (10):** `#metadata`, `#flow`, `#sectioning`, `#heading`, `#phrasing`, `#embedded`, `#interactive`, `#palpable`, `#script-supporting`, plus one empty placeholder
|
|
128
|
+
- **SVG (19):** `#SVGAnimation`, `#SVGBasicShapes`, `#SVGContainer`, `#SVGDescriptive`, `#SVGFilterPrimitive`, `#SVGFont`, `#SVGGradient`, `#SVGGraphics`, `#SVGGraphicsReferencing`, `#SVGLightSource`, `#SVGNeverRendered`, `#SVGPaintServer`, `#SVGRenderable`, `#SVGShape`, `#SVGStructural`, `#SVGStructurallyExternal`, `#SVGTextContent`, `#SVGTextContentChild`, plus one empty placeholder
|
|
129
|
+
|
|
130
|
+
### `specs`
|
|
131
|
+
|
|
132
|
+
An array of element specifications. Each entry defines a single HTML or SVG element with its content model, permitted attributes, ARIA role mappings, and categorization.
|
|
133
|
+
|
|
134
|
+
## Core Components
|
|
135
|
+
|
|
136
|
+
| Component | Files | Purpose |
|
|
137
|
+
| --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
138
|
+
| Source Specifications | 177 `src/spec.*.jsonc` files | Per-element definitions: content models, attributes, ARIA mappings |
|
|
139
|
+
| Common Definitions | `spec-common.attributes.jsonc`, `spec-common.contents.jsonc` | Shared global attribute categories and content model category macros |
|
|
140
|
+
| Build System | `build.mjs` | Invokes `@markuplint/spec-generator` to merge sources with external data |
|
|
141
|
+
| Generated Output | `index.json` | Single consolidated dataset consumed by downstream packages |
|
|
142
|
+
| Type Declarations | `index.d.ts` | Re-exports `Cites`, `ElementSpec`, `SpecDefs` from `@markuplint/ml-spec` |
|
|
143
|
+
| Schema Validation | `test/structure.spec.mjs` | Ajv-based validation of generated output against `@markuplint/ml-spec` schemas |
|
|
144
|
+
|
|
145
|
+
## External Dependencies
|
|
146
|
+
|
|
147
|
+
| Dependency | Type | Purpose |
|
|
148
|
+
| ---------------------------- | ---------- | ------------------------------------------------------------ |
|
|
149
|
+
| `@markuplint/ml-spec` | Production | Type definitions (`Cites`, `ElementSpec`, `SpecDefs`) |
|
|
150
|
+
| `@markuplint/spec-generator` | Dev | Build pipeline: merges manual specs with MDN/W3C/WHATWG data |
|
|
151
|
+
| `@markuplint/test-tools` | Dev | Test utilities (`glob` for file discovery) |
|
|
152
|
+
|
|
153
|
+
## Integration Points
|
|
154
|
+
|
|
155
|
+
```mermaid
|
|
156
|
+
flowchart LR
|
|
157
|
+
subgraph upstream ["Upstream"]
|
|
158
|
+
mlSpec["@markuplint/ml-spec\n(types + schemas)"]
|
|
159
|
+
specGen["@markuplint/spec-generator\n(build tool)"]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
subgraph pkg ["@markuplint/html-spec"]
|
|
163
|
+
srcData["177 element specs\n+ 2 common files"]
|
|
164
|
+
indexJson["index.json\n(generated output)"]
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
subgraph downstream ["Downstream"]
|
|
168
|
+
mlCore["@markuplint/ml-core"]
|
|
169
|
+
rules["@markuplint/rules"]
|
|
170
|
+
vueSpec["@markuplint/vue-spec"]
|
|
171
|
+
reactSpec["@markuplint/react-spec"]
|
|
172
|
+
otherSpec["Other framework specs"]
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
mlSpec -->|"types, schemas"| pkg
|
|
176
|
+
specGen -->|"build pipeline,\nexternal data fetching"| srcData
|
|
177
|
+
|
|
178
|
+
srcData -->|"build.mjs"| indexJson
|
|
179
|
+
|
|
180
|
+
indexJson -->|"MLMLSpec JSON"| mlCore
|
|
181
|
+
indexJson -->|"element specs,\nARIA definitions"| rules
|
|
182
|
+
indexJson -->|"base data\n(extended by frameworks)"| vueSpec
|
|
183
|
+
indexJson -->|"base data\n(extended by frameworks)"| reactSpec
|
|
184
|
+
indexJson -->|"base data\n(extended by frameworks)"| otherSpec
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Upstream
|
|
188
|
+
|
|
189
|
+
- **`@markuplint/ml-spec`** provides the TypeScript type definitions (`MLMLSpec`, `ElementSpec`, `SpecDefs`) and JSON schemas used to validate the generated output. The `index.d.ts` re-exports these types.
|
|
190
|
+
- **`@markuplint/spec-generator`** is the build tool invoked by `build.mjs`. It reads the source JSON files, fetches live data from MDN Web Docs, W3C ARIA specifications (versions 1.1, 1.2, 1.3), Graphics ARIA, DPub ARIA, HTML-ARIA mappings, the HTML Living Standard, and SVG specifications, then merges everything into `index.json`.
|
|
191
|
+
|
|
192
|
+
### Downstream
|
|
193
|
+
|
|
194
|
+
- **`@markuplint/ml-core`** loads the `MLMLSpec` JSON to build its internal representation of elements with spec awareness.
|
|
195
|
+
- **`@markuplint/rules`** consumes element specifications and ARIA definitions to implement lint rules for role validation, content model checking, and accessibility auditing.
|
|
196
|
+
- **Framework spec packages** (`@markuplint/vue-spec`, `@markuplint/react-spec`, etc.) extend this base dataset with framework-specific elements, attributes, and component definitions.
|
|
197
|
+
|
|
198
|
+
## Documentation Map
|
|
199
|
+
|
|
200
|
+
- [Element Specification Format](docs/element-spec-format.md) -- Structure and fields of per-element JSON files
|
|
201
|
+
- [Build Pipeline](docs/build-pipeline.md) -- How build.mjs and spec-generator produce index.json
|
|
202
|
+
- [Maintenance Guide](docs/maintenance.md) -- Adding elements, updating external sources, troubleshooting
|
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **html-spec:** add aria-valuenow restrictions and missing alt fields ([b5af2b5](https://github.com/markuplint/markuplint/commit/b5af2b57238e40c4bf807fb968b4309871709046)), closes [#3214](https://github.com/markuplint/markuplint/issues/3214) [#2465](https://github.com/markuplint/markuplint/issues/2465)
|
|
11
|
+
- **html-spec:** add missing dpub-aria source URL to generated spec data ([0797e83](https://github.com/markuplint/markuplint/commit/0797e832a4b1c6ce80b1dc32529228db5a3e07cb))
|
|
12
|
+
- **html-spec:** fix optgroup selector and remove stale comment ([f6bcd7f](https://github.com/markuplint/markuplint/commit/f6bcd7f7036516e236117c34349085986efacfc3))
|
|
13
|
+
- **html-spec:** mark input switch attribute as non-standard ([5b28f44](https://github.com/markuplint/markuplint/commit/5b28f447b31f38420b8e0cc91827f66e0fe4331d))
|
|
14
|
+
- **html-spec:** update ARIA role descriptions for combobox, tab, and tabpanel ([4b8e5cc](https://github.com/markuplint/markuplint/commit/4b8e5cc69c9e2bd1c83b8dbf0a991324263a7156))
|
|
15
|
+
- **html-spec:** update as attribute enum values based on WHATWG spec changes ([f10bd77](https://github.com/markuplint/markuplint/commit/f10bd77e647d37b41a0ee99b1adfe4fd0cb42831)), closes [whatwg/html#10212](https://github.com/whatwg/html/issues/10212) [whatwg/html#11981](https://github.com/whatwg/html/issues/11981) [#1987](https://github.com/markuplint/markuplint/issues/1987)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- **html-spec:** add 41 DPub ARIA roles to generated spec data ([a98b9e5](https://github.com/markuplint/markuplint/commit/a98b9e53b5d96b700e66291dd643534f7df5cbaf))
|
|
20
|
+
- **html-spec:** require href or imagesrcset on link element ([e6a2631](https://github.com/markuplint/markuplint/commit/e6a26318ed8e4be9ba4e81884eb0b879a816efb5)), closes [#717](https://github.com/markuplint/markuplint/issues/717)
|
|
9
21
|
|
|
22
|
+
# [4.17.0](https://github.com/markuplint/markuplint/compare/@markuplint/html-spec@4.16.1...@markuplint/html-spec@4.17.0) (2026-02-10)
|
|
10
23
|
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- **html-spec:** add math and meter to img permitted roles ([97c9de0](https://github.com/markuplint/markuplint/commit/97c9de0596d2b9b17f91c875e853def4e45ec36b))
|
|
27
|
+
- **html-spec:** add permitted roles to button per html-aria ([1bcdf1b](https://github.com/markuplint/markuplint/commit/1bcdf1b2894908a4d05d80458cfb5ccbbc1029b8))
|
|
28
|
+
- **html-spec:** correct implicit role typo for meter element ([c7dc7c9](https://github.com/markuplint/markuplint/commit/c7dc7c9174047248f9170925b22d4fea5984b49d))
|
|
29
|
+
- **html-spec:** revert over-applied role description changes ([fbc8a46](https://github.com/markuplint/markuplint/commit/fbc8a46f570ccebcafda7825305285002573df31))
|
|
30
|
+
- **html-spec:** update html element implicit role to generic ([862a67d](https://github.com/markuplint/markuplint/commit/862a67d9283cec6854b0ab7ef678d3fa3516f3fe)), closes [w3c/aria#2504](https://github.com/w3c/aria/issues/2504) [w3c/html-aria#550](https://github.com/w3c/html-aria/issues/550)
|
|
31
|
+
- **spec-generator:** merge MDN data into spec-defined attributes ([ae4db37](https://github.com/markuplint/markuplint/commit/ae4db37b109bac3daed22d8ba0a147acf2d71787))
|
|
32
|
+
|
|
33
|
+
### Features
|
|
11
34
|
|
|
35
|
+
- **html-spec:** add headingoffset and headingreset attributes ([49aa8e7](https://github.com/markuplint/markuplint/commit/49aa8e72346ea61cb62db8239ef9fe99b8a4eac3)), closes [whatwg/html#11086](https://github.com/whatwg/html/issues/11086) [whatwg/html#11979](https://github.com/whatwg/html/issues/11979)
|
|
36
|
+
- **html-spec:** add iframe privateToken attribute ([6d6a45d](https://github.com/markuplint/markuplint/commit/6d6a45d2615f95b964e479c26e13ed3904ecfeb8))
|
|
37
|
+
- **html-spec:** add input switch attribute ([3f77351](https://github.com/markuplint/markuplint/commit/3f773515c12349b88524991ddbefc8bd7206a2c9))
|
|
38
|
+
- **html-spec:** add interestfor attribute (Interest Invokers API) ([1230b8b](https://github.com/markuplint/markuplint/commit/1230b8be720a78d615c1d5ca5873e6c725e6bb92))
|
|
39
|
+
- **html-spec:** add request-close to button command attribute ([46c6093](https://github.com/markuplint/markuplint/commit/46c60938ceb37f094ab58ff034d01d4489c1ffa6))
|
|
40
|
+
- **html-spec:** add svg:switch requiredExtensions and systemLanguage attributes ([481a836](https://github.com/markuplint/markuplint/commit/481a83693ccfc6b7147783c9d841ea2d96fadfef))
|
|
41
|
+
- **html-spec:** add template shadowrootreferencetarget attribute ([dd78b8a](https://github.com/markuplint/markuplint/commit/dd78b8a75e4a034555741b4595c95cb535370ad0))
|
|
42
|
+
- **html-spec:** deprecate attributionsrc attribute ([e12cf46](https://github.com/markuplint/markuplint/commit/e12cf4625e778e9e64ba6aef08b0e7c5b18b8c29))
|
|
43
|
+
- **html-spec:** deprecate browsingtopics attribute on iframe ([27f54cf](https://github.com/markuplint/markuplint/commit/27f54cf3d349089ef2a972d14a386bfd9b2909c9))
|
|
44
|
+
- **html-spec:** update scrollbar aria-controls from required to inherited ([14aeec5](https://github.com/markuplint/markuplint/commit/14aeec5e4e01ef32ba147a9ff49a5d5c44558901))
|
|
12
45
|
|
|
46
|
+
## [4.16.1](https://github.com/markuplint/markuplint/compare/@markuplint/html-spec@4.16.0...@markuplint/html-spec@4.16.1) (2025-11-05)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @markuplint/html-spec
|
|
13
49
|
|
|
14
50
|
# [4.16.0](https://github.com/markuplint/markuplint/compare/@markuplint/html-spec@4.15.0...@markuplint/html-spec@4.16.0) (2025-08-24)
|
|
15
51
|
|