Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev, .circleci/config.yml, .markdownlint.yaml: Add markdown style check for dev folder #1494

Merged
merged 11 commits into from
Jul 9, 2019
Merged

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Jun 23, 2019

Signed-off-by: Aylei rayingecho@gmail.com

What is changed, added or deleted?

  • Add markdown style check (based on markdownlint) for dev folder and README.md.
  • Fix all lint errors appeared in /dev/ folder
  • Leave the errors in README.md unchanged in order to verify the CI check (I will fix these errors after the code review complete)

What is the related PR or file link(s)?

To close the #1463 issue.

Which version does your change affect?

It might apply to all versions.

@yikeke @CaitinChen @lilin90 PTAL

The 29 markdownlint rules that is given by Coco and implemented in this PR:

  • 1. MD001 - Heading levels should only increment by one level at a time
  • 2. MD041 - First line in file should be a top level heading (这条规则会自动忽略我们文档中头几行的 yaml metadata,直接检查后面有没有一级标题;计划后续支持对文档开头必须加上 metadata 的检查。)
  • 3. MD003 - Heading style (我们的文档中规定统一使用 ATX heading style)
  • 4. MD007 - Unordered list indentation (除 TOC.md 文件缩 2 格外,其他所有 md 文件默认缩进 4 个空格)
  • 5. MD009 - Trailing spaces
  • 6. MD010 - Hard tabs (code_blocks=true)(不要用 tab,统一用空格代替)
  • 7. MD012 - Multiple consecutive blank lines
  • 8. MD014 - Dollar signs used before commands without showing output
  • 9. MD018 - No space after hash on atx style heading
  • 10. MD019 - Multiple spaces after hash on atx style heading
  • 11. MD022 - Headings should be surrounded by blank lines (标题上下均空一行)
  • 12. MD023 - Headings must start at the beginning of the line
  • 13. MD024 - Multiple headings with the same content (siblings_only=true)
  • 14. MD025 - Multiple top level headings in the same document
  • 15. MD026 - Trailing punctuation in heading (允许标题后有中英文问号、反引号、中英文单双引号‘ ” ' ” 等)
  • 16. MD027 - Multiple spaces after blockquote symbol
  • 17. MD029 - Ordered list item prefix (从 1 开始,按顺序,不用支持 0-prefix)
  • 18. MD030 - Spaces after list markers (中间一个空格就好)
  • 19. MD031 - Fenced code blocks should be surrounded by blank lines
  • 20. MD032 - Lists should be surrounded by blank lines
  • 21. MD034 - Bare URL used
  • 22. MD037 - Spaces inside emphasis markers
  • 23. MD038 - Spaces inside code span elements
  • 24. MD039 - Spaces inside link text
  • 25. MD042 - No empty links
  • 26. MD044 - Proper names should have the correct capitalization (name{TiDB, TiKV, PingCAP, 待补充},code_blocks=false)
  • 27. MD045 - Images should have alternate text (alt text)
  • 28. MD046 - Code block style (style=fenced)
  • 29. MD047 - Files should end with a single newline character

See all of the 49 markdownlint rules for details.

Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei aylei changed the title Add markdown style check for dev folder [DNM] Add markdown style check for dev folder Jun 23, 2019
@aylei aylei changed the title [DNM] Add markdown style check for dev folder Add markdown style check for dev folder Jun 24, 2019
@aylei
Copy link
Contributor Author

aylei commented Jun 24, 2019

@yikeke @lilin90 markdown files that violate the rules will fail the CI check like this, PTAL

@aylei aylei requested a review from xuechunL June 24, 2019 07:18
@aylei
Copy link
Contributor Author

aylei commented Jun 24, 2019

@xuechunL PTAL

@lilin90 lilin90 added the DNM label Jun 25, 2019
@lilin90 lilin90 removed the DNM label Jul 2, 2019
@yikeke yikeke added the DNM label Jul 7, 2019
@@ -30,19 +30,19 @@ IDC 机器
| OS | linux (CentOS 7.3.1611) |
| CPU | 40 vCPUs, Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz |
| RAM | 128GB |
| DISK | 1.5T SSD * 2 + Optane SSD * 1 |
| DISK | 1.5T SSD \* 2 + Optane SSD \* 1 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "" the escape character? Why we need it here?

Copy link
Contributor Author

@aylei aylei Jul 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* sign is used to italic or bold the text in markdown, so it is recommended to use \ to escape the * sign

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see MD037

dev/faq/tidb.md Show resolved Hide resolved
dev/how-to/deploy/orchestrated/ansible.md Show resolved Hide resolved
|pd1|http://host1:2379|http://host1:2380|
|pd2|http://host2:2379|http://host2:2380|
|pd3|http://host3:2379|http://host3:2380|
|pd1|`http://host1:2379`|`http://host1:2380`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|pd1|`http://host1:2379`|`http://host1:2380`|
|pd1|http://host1:2379|http://host1:2380|

这里需要 bare url,不希望被反引号包裹,怎么解决呢?
规则见 MD034 - Bare URL used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我认为应该被反引号包裹, 部分页面上会把 bare URL 渲染成 hyperlink, 用户点过去是没有意义的

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aylei 不能点的链接可以加反引号,咱们文档里还有一些链接是能点的,这些我们尽量在之后的风格指南里来限定下规则,使用 <url> 或者 []()[]() 目前有一些,是为了 fix 链接与后面紧接着的逗号和句号均被识别为 url 的一部分导致的死链。

Copy link
Contributor Author

@aylei aylei Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能点的目前我都修改成了 [www.pingcap.com](www.pingcap.com) 这种形式

@yikeke
Copy link
Contributor

yikeke commented Jul 7, 2019

@yikeke @lilin90 markdown files that violate the rules will fail the CI check like this, PTAL

Thanks so much for your work. Most of the file changes look good to me. I see that you just checked and changed the dev files, if this check finally works, we can then apply it to all other files. :)

I made some small comments, PTAL.

@yikeke yikeke changed the title Add markdown style check for dev folder dev, .circleci/config.yml, .markdownlint.yaml: Add markdown style check for dev folder Jul 7, 2019
@yikeke yikeke added the dev label Jul 7, 2019
@aylei
Copy link
Contributor Author

aylei commented Jul 8, 2019

Note that MD014 is disabled now because not all $ signs in code blocks are eliminated now @yikeke , you can enable this rule when the change completes.

@yikeke
Copy link
Contributor

yikeke commented Jul 8, 2019

Note that MD014 is disabled now because not all $ signs in code blocks are eliminated now @yikeke , you can enable this rule when the change completes.

Okay, thanks!

Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Jul 8, 2019

@yikeke I've fixed the markdownlint errors introduced by the merge along with the errors in the README.md.

If you are okay with my responses to your review comments, this PR is ready to merge.

PS: after merging this PR, we should merge master to PRs that have not run CI checks yet so that these PRs can be properly linted.

@yikeke
Copy link
Contributor

yikeke commented Jul 9, 2019

@yikeke I've fixed the markdownlint errors introduced by the merge along with the errors in the README.md.

If you are okay with my responses to your review comments, this PR is ready to merge.

PS: after merging this PR, we should merge master to PRs that have not run CI checks yet so that these PRs can be properly linted.

Please take a final look at this PR. If it looks good to you, I'll notify all relevant members about this markdown lint check via email and then merge this PR. @lilin90

Please take a technical review at this. Thanks. @xuechunL @YiniXu9506

@YiniXu9506
Copy link
Contributor

LGTM

Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Jul 9, 2019

I've added the rule MD041, PTAL @yikeke

Copy link
Contributor

@yikeke yikeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. PTAL again. @lilin90

@yikeke yikeke removed the DNM label Jul 9, 2019
style: atx
no-trailing-spaces: true
no-hard-tabs:
code_blocks: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need this check in code blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure that people use spaces instead of tabs in code blocks too. Please change this setting, thanks! @aylei

no-space-in-links: true
no-empty-links: true
proper-names:
name: ['TiDB', 'TiKV', 'PingCAP']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have some lower-case TiDB or TiKV in normal text, such as some components, charts, or parameters with the inline code format.

aylei added 2 commits July 9, 2019 15:24
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Jul 9, 2019

@lilin90 Thanks! I've addressed the comments and PTAL

Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CaitinChen
Copy link
Contributor

@aylei Great!!!

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.

5 participants