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

Allow leading spaces for reference links #366

Closed
wants to merge 1 commit into from

Conversation

stmcginnis
Copy link
Contributor

Some of the sites that get pulled in use a mix of inline and reference links. Reference links are expected to have the format of the link reference name in brackets, starting at the beginning of the line, followed by a colon and then the linked target.

Some of the external sites have been found to have some variation on this format though. While markdown references show the format as above, it does work when these link references have leading spacing before the opening bracket. This has caused broken slack links, as one example.

This change updates the regex for identifying these reference links in the get-content script to allow for leading spaces.

Some of the sites that get pulled in use a mix of inline and reference
links. Reference links are expected to have the format of the link
reference name in brackets, starting at the beginning of the line,
followed by a colon and then the linked target.

Some of the external sites have been found to have some variation on
this format though. While markdown references show the format as above,
it does work when these link references have leading spacing before the
opening bracket. This has caused [broken slack
links](kubernetes/community#6934), as one
example.

This change updates the regex for identifying these reference links in
the get-content script to allow for leading spaces.

Signed-off-by: Sean McGinnis <[email protected]>
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: stmcginnis
Once this PR has been reviewed and has the lgtm label, please assign jeefy for approval by writing /assign @jeefy in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @stmcginnis!

It looks like this is your first PR to kubernetes/contributor-site 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/contributor-site has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 11, 2023
@mrbobbytables
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 11, 2023
Copy link
Member

@mrbobbytables mrbobbytables left a comment

Choose a reason for hiding this comment

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

Hm..while we don't have a tests for it - I did a manual check and it seems to break other links =/

here is live: https://www.kubernetes.dev/docs/guide/#community-expectations-and-roles
here is a preview: https://deploy-preview-366--kubernetes-contributor.netlify.app/docs/guide/#community-expectations-and-roles

The 'fuzzyness' of markdown and the regexes have been the bane of the ingestion script -_-

There have been a few attempts to rewrite everything in go and use a native markdown parser, but those have also had other issues.

@stmcginnis
Copy link
Contributor Author

Hmm... there are definitely parts where this is not correct. I can see some cases where there are example markdown comments in docstrings that could be problematic here. There's likely other conditions.

It looks like maybe the safest thing for now would be to just enforce that legitimate link references do not have leading characters. I can try to watch out for those and help catch any incoming issues in reviews.

In the meantime, I'll watch #93 and see if there is any progress there. If I have a good time block to focus on it, I may take that over and give it one more shot. Currently assigned, but that was quite awhile ago and there hasn't been any progress. So likely they didn't realize the amount of work they were signing up for with that one. :D

Will close this for now since it definitely is the best approach. Thanks for taking a look!

@stmcginnis stmcginnis closed this Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants