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

Add some checks for blog repo #579

Merged
merged 25 commits into from
Jun 10, 2021
Merged

Add some checks for blog repo #579

merged 25 commits into from
Jun 10, 2021

Conversation

ran-huang
Copy link
Contributor

@ran-huang ran-huang commented May 12, 2021

This PR made the following changes:

  • Add 2 checks to blog repo:
    1. pull:
      • Check file encoding
      • Markdown lint
      • Check control characters
      • Check unclosed tags
      • Check manual line breaks
    2. verify-links:
      • Verify internal links
      • Verify internal link anchors (this is currently commented out, because the script reports #top as a dead link.)
  • Fix all past lint errors
  • Update markdownlint rules for blog

Related issue: #577

Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
@ran-huang ran-huang marked this pull request as ready for review May 12, 2021 11:28
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
@ran-huang ran-huang changed the title Add lint Add some checks for blog repo May 13, 2021
@CaitinChen
Copy link
Contributor

@YiniXu9506 PTAL

- name: Verify internal links
run: ./hack/verify-links-doc.sh
# the script reports "#top" as dead anchor.
# - name: Verify internal link anchors
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to verify internal link anchors, if yes, uncomment this step, otherwise, remove file hack/verify-link-anchors.sh.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We need to verify internal link anchors.

But currently, we have lots of #top anchors in old blog articles (e.g. https://pingcap.com/blog/2017-07-11-tidbinternal1#top), which are not regular markdown anchors and are thus reported "dead anchor" by this script.

I will find a workaround to address this issue. But before that, I had to comment out this step.

Copy link
Contributor

@YiniXu9506 YiniXu9506 May 18, 2021

Choose a reason for hiding this comment

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

Got it. The #top is a useless anchor, I think you can remove it directly.

.github/workflows/ci.yml Show resolved Hide resolved
trap 'rm -f $CONFIG_TMP $ERROR_REPORT' EXIT

# Check all directories starting with 'v\d.*' and dev.
for d in zh en; do
Copy link
Contributor

Choose a reason for hiding this comment

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

There are no folders named zh and en, so we need to add the for loop here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Ran <huangran@pingcap.com>

fix script

Signed-off-by: Ran <huangran@pingcap.com>

add markdown-link-check.tpl

Signed-off-by: Ran <huangran@pingcap.com>

fix replacementpatterns

Signed-off-by: Ran <huangran@pingcap.com>

fix a single quote in filename

Signed-off-by: Ran <huangran@pingcap.com>

fix wrong replacementpatterns

Signed-off-by: Ran <huangran@pingcap.com>

test verify-links.sh

Signed-off-by: Ran <huangran@pingcap.com>

fix again script

Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
@ran-huang
Copy link
Contributor Author

@YiniXu9506 PTAL. Thanks!

Signed-off-by: Ran <huangran@pingcap.com>

fix manual link breaks

Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
Signed-off-by: Ran <huangran@pingcap.com>
@@ -0,0 +1,52 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this shell file is the same as /hack/verify-link, which is also removed from circleci task, so you can keep this and remove that one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done~

@@ -0,0 +1,15 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

It seem this shell file is the same as hack/markdown-link-check.json, you can keep this and remove that one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done~

Signed-off-by: Ran <huangran@pingcap.com>
Copy link
Contributor

@YiniXu9506 YiniXu9506 left a comment

Choose a reason for hiding this comment

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

LGTM

@ran-huang ran-huang merged commit 18675c4 into pingcap:master Jun 10, 2021
@ran-huang ran-huang deleted the add-lint branch June 10, 2021 09:23
@ran-huang ran-huang mentioned this pull request Jul 28, 2021
5 tasks
This pull request was closed.
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.

3 participants