@huangjunsen/markdownlint-config 1.0.1 → 1.0.2
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 +95 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @huangjunsen/markdownlint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Markdown 文档的共享检查规范,适用于 README、文档站点与技术方案等 Markdown 文件。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @huangjunsen/markdownlint-config markdownlint --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> `markdownlint` 为可选的 peer 依赖(`>=0.25.0`)。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 使用
|
|
18
|
+
|
|
19
|
+
在项目根目录创建 `.markdownlint.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"extends": "@huangjunsen/markdownlint-config"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 规范内容
|
|
30
|
+
|
|
31
|
+
配置以 `markdownlint` 的 `default: true` 为基线(即开启全部规则),再按「文档写作习惯」逐项调整。
|
|
32
|
+
|
|
33
|
+
### 收紧的规则
|
|
34
|
+
|
|
35
|
+
| 规则 | 配置 | 说明 |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `ul-style` | `dash` | 无序列表统一使用 `-` |
|
|
38
|
+
| `no-trailing-spaces` | `br_spaces: 0`、`list_item_empty_lines: false` | 禁止行尾空格,列表项之间不留空行也不允许用行尾空格占位 |
|
|
39
|
+
| `fenced-code-language` | `true` | 围栏代码块必须声明语言 |
|
|
40
|
+
|
|
41
|
+
### 放宽 / 关闭的规则
|
|
42
|
+
|
|
43
|
+
| 规则 | 配置 | 原因 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `line-length` | `false` | 中文文档按字符数限制行长意义不大 |
|
|
46
|
+
| `list-marker-space` | `false` | 与 Prettier 的列表输出保持一致 |
|
|
47
|
+
| `no-inline-html` | `false` | 允许 Badge、`<details>` 等内联 HTML |
|
|
48
|
+
| `no-duplicate-header` | `false` | 允许不同章节下出现同名子标题 |
|
|
49
|
+
| `proper-names.code_blocks` | `false` | 不检查代码块内的专有名词大小写 |
|
|
50
|
+
|
|
51
|
+
### `proper-names` 专有名词表
|
|
52
|
+
|
|
53
|
+
内置约 100 个前端领域的专有名词,命中错误大小写时给出提示,例如:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Javascript → JavaScript Github → GitHub
|
|
57
|
+
Http → HTTP Npm → npm
|
|
58
|
+
Vuejs → Vue.js Typescript → TypeScript
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 配置文件格式
|
|
64
|
+
|
|
65
|
+
| 格式 | 文件名 |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| 官方推荐 | `.markdownlint.{jsonc,json,yaml,yml,cjs,mjs}` |
|
|
68
|
+
| cli2 专用 | `.markdownlint-cli2.{jsonc,yaml,cjs,mjs}` |
|
|
69
|
+
| cli2 忽略 | `.markdownlint-cli2.jsonc` 中的 `ignores` 字段 |
|
|
70
|
+
|
|
71
|
+
> ⚠️ `markdownlint-cli2` **不支持** `.markdownlintrc` 与 `.markdownlintignore`。
|
|
72
|
+
> `encode-fe-lint` 会读取项目根目录的 `.markdownlintignore`,并与内置忽略规则合并。
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 与 `encode-fe-lint` 的协作方式
|
|
77
|
+
|
|
78
|
+
`encode-fe-lint` 按以下优先级确定 markdownlint 配置:
|
|
79
|
+
|
|
80
|
+
1. 项目存在 `.markdownlint.*` 或 `.markdownlint-cli2.*`
|
|
81
|
+
→ 加载项目配置;
|
|
82
|
+
2. 以上均无 → 使用 `@huangjunsen/markdownlint-config` 作为默认配置。
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 相关包
|
|
87
|
+
|
|
88
|
+
- [`@huangjunsen/encode-fe-lint`](https://www.npmjs.com/package/@huangjunsen/encode-fe-lint) —— 一键接入与扫描的 CLI
|
|
89
|
+
- [`@huangjunsen/eslint-config`](https://www.npmjs.com/package/@huangjunsen/eslint-config)
|
|
90
|
+
- [`@huangjunsen/stylelint-config`](https://www.npmjs.com/package/@huangjunsen/stylelint-config)
|
|
91
|
+
- [`@huangjunsen/prettier-config`](https://www.npmjs.com/package/@huangjunsen/prettier-config)
|
|
92
|
+
- [`@huangjunsen/commitlint-config`](https://www.npmjs.com/package/@huangjunsen/commitlint-config)
|
|
93
|
+
|
|
94
|
+
## 文档
|
|
95
|
+
|
|
96
|
+
完整说明见 [项目文档](https://huangjunsen0406.github.io/js-encode-fe-spec/packages/markdownlint-config.html)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huangjunsen/markdownlint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "index.json",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.json",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint"
|
|
14
14
|
],
|
|
15
15
|
"author": "Huangjunsen <951434130@qq.com>",
|
|
16
|
-
"homepage": "https://github.
|
|
16
|
+
"homepage": "https://huangjunsen0406.github.io/js-encode-fe-spec/packages/markdownlint-config.html",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"markdownlint": ">=0.25.0"
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/
|
|
28
|
+
"url": "git+https://github.com/huangjunsen0406/js-encode-fe-spec.git"
|
|
29
29
|
},
|
|
30
30
|
"bugs": {
|
|
31
|
-
"url": "https://github.com/
|
|
31
|
+
"url": "https://github.com/huangjunsen0406/js-encode-fe-spec/issues"
|
|
32
32
|
}
|
|
33
33
|
}
|