Skip to content

chore: add eslint-plugin-md-style to v4 branch#968

Open
NoiseFan wants to merge 2 commits intovitest-dev:v4from
NoiseFan:4.x
Open

chore: add eslint-plugin-md-style to v4 branch#968
NoiseFan wants to merge 2 commits intovitest-dev:v4from
NoiseFan:4.x

Conversation

@NoiseFan
Copy link
Copy Markdown
Collaborator

@NoiseFan NoiseFan commented May 4, 2026

在提交PR之前,请确保你执行以下操作:

  • 曾阅读过翻译须知
  • 检查是否已经有PR以同样的方式解决问题,以避免创建重复。
  • 在此PR中描述正在解决的问题,或引用它解决的问题(例如:fixes #123)。

描述

添加新 eslint 包

添加 eslint-plugin-md-style 包,适用于 CJK 语言环境的 md 文档格式化。

其意图为:保证书写风格一致、后续无需为风格投入大量精力

初期在 v4 分支上进行测试,稳定之后将在 v1, v2, v3, dev 分支上线,如后续碰到问题可直接联系我~

移除无效文件

  • config/file.md

附加上下文

  1. 添加 valid-heading-anchor 对标题自定义锚点进行校验
  • 发现未添加的自定义 anchor
  • 自动修复 anchor:查找 md 文件内的标题,如果标题是 CJK 且 # 号后面有相关英文将会自动 fix

示例

原始内容:
## 模拟函数和对象 

手动复制原文标题到中文翻译之后
## 模拟函数和对象 #Mocking Functions and Objects

修复后结果:
## 模拟函数和对象 {#mocking-functions-and-objects}
  1. 添加 valid-heading-anchor 对链接前后空格进行校验
  • 自动修复链接前后的空格
  • 其规则为:
    • 链接前后必须携带一个空格
    • 如果链接前后碰到对应标点符号则不需要添加空格
    • 如果以链接开头或结尾无需添加空格

示例

In the [Getting Started](/guide/) guide,
在。[入门指南](/guide/) 中,

@NoiseFan
Copy link
Copy Markdown
Collaborator Author

NoiseFan commented May 4, 2026

从目前的 diff 中看 lint 之后的结果均符合预期。

@NoiseFan NoiseFan changed the title chore: add eslint-plugin-docs-style to v4 branch chore: add eslint-plugin-md-style to v4 branch May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant