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

yaml: add processing for internal links, and tests #49

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Feb 11, 2024

Relates to:

Adds a preprocessing step for links when generating yaml,
reformatting internal, relative links between CLI docs.

Internal links between docs have some variation of the following syntax:

  • [linktext](cmd_subcmd.md)
  • [linktext](./cmd_subcmd.md)

Links may also contain an optional anchor:

  • [linktext](cmd_subcmd.md#anchor)
  • [linktext](./cmd_subcmd.md#anchor)

The added preprocessing step rewrites these links in the yaml conversion to:

  • [linktext](/reference/cli/docker/cmd/subcmd/)
  • [linktext](/reference/cli/docker/cmd/subcmd/#anchor)

Also added tests:

  • for the above case, and
  • for stripping https://docs.docker.com from links (preexisting)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e1a3957) 67.36% compared to head (d13ddac) 69.58%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   67.36%   69.58%   +2.22%     
==========================================
  Files           4        4              
  Lines         576      434     -142     
==========================================
- Hits          388      302      -86     
+ Misses        132       76      -56     
  Partials       56       56              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dvdksn
Copy link
Contributor Author

dvdksn commented Feb 11, 2024

PTAL @thaJeztah @crazy-max @tonistiigi

@dvdksn
Copy link
Contributor Author

dvdksn commented Feb 12, 2024

ugh, I just realized this doesnt work in docker/cli because dockerd.md is currently in the same directory as the docker cli reference files, but on docs.docker.com it will be served under a different url path.

@dvdksn dvdksn closed this Feb 12, 2024
@dvdksn dvdksn reopened this Feb 13, 2024
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn force-pushed the rewrite-internal-links branch from d13ddac to 869802d Compare February 13, 2024 13:17
@dvdksn
Copy link
Contributor Author

dvdksn commented Feb 13, 2024

this one's ready to go I think. I've updated (reverted) the docker/buildx and docker/cli PRs to use relative links again, and used this fork of cli-docs-tool to test them. Worked as expected

@dvdksn dvdksn requested a review from crazy-max February 13, 2024 13:42
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Thanks LGTM, PTAL @thaJeztah

@dvdksn
Copy link
Contributor Author

dvdksn commented Feb 13, 2024

Rebased docker/docs#19370 and it's green now again, so we should be good to go ahead in the following order:

markdown.go Show resolved Hide resolved
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM

@crazy-max crazy-max merged commit 3149c91 into docker:main Feb 19, 2024
3 checks passed
@dvdksn dvdksn deleted the rewrite-internal-links branch February 19, 2024 17:47
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.

4 participants