Skip to content

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

Merged
crazy-max merged 1 commit into
docker:mainfrom
dvdksn:rewrite-internal-links
Feb 19, 2024
Merged

yaml: add processing for internal links, and tests#49
crazy-max merged 1 commit into
docker:mainfrom
dvdksn:rewrite-internal-links

Conversation

@dvdksn

@dvdksndvdksn commented Feb 11, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
ContributorAuthor

@dvdksn

Copy link
Copy Markdown
ContributorAuthor

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.

@dvdksndvdksn closed this Feb 12, 2024
@dvdksndvdksn reopened this Feb 13, 2024
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn
dvdksnforce-pushed the rewrite-internal-links branch from d13ddac to 869802dCompareFebruary 13, 2024 13:17
@dvdksn

Copy link
Copy Markdown
ContributorAuthor

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

@crazy-maxcrazy-max left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

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

Comment threadmarkdown.go

@crazy-maxcrazy-max left a comment

Copy link
Copy Markdown
Member

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:mainFeb 19, 2024
@dvdksn
dvdksn deleted the rewrite-internal-links branch February 19, 2024 17:47
Sign up for freeto 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

@dvdksn@codecov-commenter@thaJeztah@crazy-max