Skip to content

Commit 3860223

Browse files
committed
docs(html): levels
1 parent a3d2862 commit 3860223

File tree

2 files changed

+55
-22
lines changed

2 files changed

+55
-22
lines changed

docs/coding/html.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ order: 1
2727

2828
## DOCTYPE
2929

30-
### `mandatory` Must have doctype at the beginning
30+
### Must have doctype at the beginning
31+
32+
Level: **Mandatory**
3133

3234
```html
3335
<!-- ❌ missing doctype -->
@@ -43,7 +45,9 @@ order: 1
4345
<html lang="zh-CN"></html>
4446
```
4547

46-
### `mandatory` Must use HTML5 lowercase doctype
48+
### Must use HTML5 lowercase doctype
49+
50+
Level: **Mandatory**
4751

4852
```html
4953
<!-- ❌ xhtml doctype -->
@@ -66,7 +70,9 @@ order: 1
6670

6771
## `<html>` element
6872

69-
### `mandatory` Must have and only have one `<html>` element at root
73+
### Must have and only have one `<html>` element at root
74+
75+
Level: **Mandatory**
7076

7177
```html
7278
<!-- ❌ missing <html> -->
@@ -99,7 +105,9 @@ order: 1
99105
</html>
100106
```
101107

102-
## `mandatory` `<html>` element must have `lang` attribute
108+
### `<html>` element must have `lang` attribute
109+
110+
Level: **Mandatory**
103111

104112
`lang` attribute is important for search engines, screen readers and translation tools. The value is usually in `language-REGION` format, e.g. `en-US`, `zh-CN`.
105113

@@ -133,7 +141,9 @@ If a part of the document is written in another language, add `lang` attribute t
133141
</html>
134142
```
135143

136-
### `mandatory` `<html>` must have and only have one `<head>` and one `<body>` as children
144+
### `<html>` must have and only have one `<head>` and one `<body>` as children
145+
146+
Level: **Mandatory**
137147

138148
```html
139149
<!-- ❌ missing <head> -->
@@ -171,7 +181,9 @@ If a part of the document is written in another language, add `lang` attribute t
171181

172182
## `<meta>` elements
173183

174-
### `mandatory` `<meta>` element must be contained in `<head>` element
184+
### `<meta>` element must be contained in `<head>` element
185+
186+
Level: **Mandatory**
175187

176188
```html
177189
<!-- ❌ <meta> in <body> -->
@@ -197,15 +209,19 @@ If a part of the document is written in another language, add `lang` attribute t
197209
</html>
198210
```
199211

200-
### `mandatory` Must use UTF-8 charset
212+
### Must use UTF-8 charset
213+
214+
Level: **Mandatory**
201215

202216
```html
203217
<head>
204218
<meta charset="utf-8" />
205219
</head>
206220
```
207221

208-
### `recommended` Responsive web page should have viewport meta
222+
### Responsive web page should have viewport meta
223+
224+
Level: **Recommended**
209225

210226
The following settings match the actual device size. Users can scale the content with touch gestures.
211227

docs/coding/html.zh.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ order: 1
2727

2828
## DOCTYPE
2929

30-
### `强制` 文档开头必须有 doctype
30+
### 文档开头必须有 doctype
31+
32+
等级:**强制**
3133

3234
```html
3335
<!-- ❌ 缺少 doctype -->
@@ -43,7 +45,9 @@ order: 1
4345
<html lang="zh-CN"></html>
4446
```
4547

46-
### `强制` 必须使用 HTML5 小写 doctype
48+
### 必须使用 HTML5 小写 doctype
49+
50+
等级:**强制**
4751

4852
```html
4953
<!-- ❌ xhtml doctype -->
@@ -66,7 +70,9 @@ order: 1
6670

6771
## `<html>` 元素
6872

69-
### `强制` 必须有且仅有一个位于顶层的 `<html>` 元素
73+
### 必须有且仅有一个位于顶层的 `<html>` 元素
74+
75+
等级:**强制**
7076

7177
```html
7278
<!-- ❌ 缺少 <html> -->
@@ -99,8 +105,9 @@ order: 1
99105
</html>
100106
```
101107

102-
## `强制` HTML 元素必须有 `lang` 属性
108+
## HTML 元素必须有 `lang` 属性
103109

110+
等级:**强制**
104111
`lang` 属性有助于搜索殷勤,屏幕阅读器、翻译工具的正常工作。属性的值通常是 `语言-地区` 格式,如 `en-US`, `zh-CN`
105112

106113
```html
@@ -133,7 +140,9 @@ order: 1
133140
</html>
134141
```
135142

136-
### `强制` `<html>` 元素的内容必须有且仅有一个 `<head>` 和一个 `<body>`
143+
### `<html>` 元素的内容必须有且仅有一个 `<head>` 和一个 `<body>`
144+
145+
等级:**强制**
137146

138147
```html
139148
<!-- ❌ 缺少 <head> -->
@@ -171,7 +180,9 @@ order: 1
171180

172181
## `<meta>` 元素
173182

174-
### `强制` `<meta>` 元素必须包含在 `<head>` 元素内
183+
### `<meta>` 元素必须包含在 `<head>` 元素内
184+
185+
等级:**强制**
175186

176187
```html
177188
<!-- ❌ <meta> 在 <body> 里 -->
@@ -197,15 +208,19 @@ order: 1
197208
</html>
198209
```
199210

200-
### `强制` 必须使用 UTF-8 字符编码
211+
### 必须使用 UTF-8 字符编码
212+
213+
等级:**强制**
201214

202215
```html
203216
<head>
204217
<meta charset="utf-8" />
205218
</head>
206219
```
207220

208-
### `推荐` 响应式页面应当设置 viewport
221+
### 响应式页面应当设置 viewport
222+
223+
等级:**推荐**
209224

210225
让页面大小适配设备实际尺寸,用户可以用手势缩放页面内容。
211226

@@ -318,8 +333,8 @@ order: 1
318333

319334
### 1.5 页面标题
320335

321-
- 1.5.1 `强制` 页面需要指定 title 标签,有且仅有 1 个。
322-
336+
- 1.5.1 页面需要指定 title 标签,有且仅有 1 个。
337+
等级:**强制**
323338
```html
324339
<head>
325340
<meta charset="utf-8" />
@@ -348,8 +363,8 @@ order: 1
348363

349364
### 2.2 注释
350365

351-
- 2.2.1 `强制` 在 HTML 注释代码中,不允许出现任何敏感信息。
352-
366+
- 2.2.1 在 HTML 注释代码中,不允许出现任何敏感信息。
367+
等级:**强制**
353368
常见的敏感信息包括:
354369

355370
- 业务相关敏感信息,例如业务规则
@@ -376,7 +391,8 @@ order: 1
376391

377392
### 2.3 标签
378393

379-
- 2.3.1 `强制` 标签名统一使用小写。
394+
- 2.3.1 标签名统一使用小写。
395+
等级:**强制**
380396

381397
```html
382398
<!-- bad -->
@@ -404,7 +420,8 @@ order: 1
404420

405421
### 2.4 属性
406422

407-
- 2.4.1 `强制` 属性值使用双引号,不要使用单引号。
423+
- 2.4.1 属性值使用双引号,不要使用单引号。
424+
等级:**强制**
408425

409426
```html
410427
<!-- bad -->

0 commit comments

Comments
 (0)