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

[Feature Request]: Incorrect links to multi-version CRDs #60

Open
tswangdi opened this issue Dec 7, 2023 · 1 comment · May be fixed by #118
Open

[Feature Request]: Incorrect links to multi-version CRDs #60

tswangdi opened this issue Dec 7, 2023 · 1 comment · May be fixed by #118

Comments

@tswangdi
Copy link

tswangdi commented Dec 7, 2023

I used crd-ref-docs to generate API documentation for a multi-version CRD.

# API Reference

## Packages
- [example.dev/v1](#exampledevv1)
- [example.dev/v2](#exampledevv2)


## example.dev/v1

### Resource Types
- [Foo](#foo)
- [FooList](#foolist)

#### Foo                        
                                <- Jump to here

## example.dev/v2

### Resource Types
- [Foo](#foo)                   <-  Click this 
- [FooList](#foolist)

#### Foo
                                <- Expect to jump to here

Clicking on the v2 version of Foo redirects to the v1 version of Foo

Refer to the implementation of Kubernetes Docs

@tswangdi tswangdi changed the title Confusion of links for multi-version CRDs [Feature Request]: Currect links for multi-version CRDs Dec 7, 2023
@tswangdi tswangdi changed the title [Feature Request]: Currect links for multi-version CRDs [Feature Request]: Incorrect links to multi-version CRDs Dec 7, 2023
@antonincms
Copy link

antonincms commented Nov 12, 2024

We also have this issue on Markdown output. I had the idea I had to fix it would be to add HTML anchors to markdown title by replacing #### Foo with #### <a id="example-dev-v2-foo">Foo</a> and replace links [Foo](#foo) with [Foo](#example-dev-v2-foo).

We also have this issue with Markdown output. My idea to fix it is to add HTML anchors around markdown titles like so #### <a id="example-dev-v2-foo">Foo</a>.

I tried to fix it in templating by replacing the anchor #### {{ $type.Name }} with #### <a id="{{ markdownTypeID $type }}">{{ $type.Name }}</a>. I also replaced package links {{ $gv.TypeForKind . | markdownRenderTypeLink }} with {{ $type := $gv.TypeForKind . }}{{ markdownRenderExternalLink (printf "#%s" ($type | markdownTypeID)) $type.Name }}.

However, it does not seem as straightforward, since markdownRenderTypeLink skips native types, and since for field links the behavior of markdownRenderType is more complex, so I guess we would need to modify both implementations, probably in a breaking way for markdownRenderTypeLink.

I made a fix that I could upstream if that's ok with maintainers.

@antonincms antonincms linked a pull request Nov 27, 2024 that will close this issue
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 a pull request may close this issue.

2 participants