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

[Bug] Markdown xref broken for external xrefmap.yml #9866

Open
glopesdev opened this issue Apr 12, 2024 · 5 comments
Open

[Bug] Markdown xref broken for external xrefmap.yml #9866

glopesdev opened this issue Apr 12, 2024 · 5 comments
Labels
bug A bug to fix

Comments

@glopesdev
Copy link

glopesdev commented Apr 12, 2024

This is a regression in 2.76.0. Confirmed that the same reference resolves fine in 2.75.3 so we are downgrading for the time being.

Markdown cross-references in articles pointing to UIDs defined in external xrefmap.yml files are resolved as if they are internal API references. For example:

[OtherClass](xref:External.Namespace.OtherClass) will resolve to http://mydomain.org/api/External.Namespace.OtherClass.html instead of http://externaldomain.org/api/External.Namespace.OtherClass.html.

To Reproduce
Steps to reproduce the behavior:

  1. Add xref section to docfx.json containing a URL to a xrefmap.yml in another domain.
  2. Add a markdown cross-reference to a UID in the external YML file.

Expected behavior
Cross-references should resolve to links pointing to the external website.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: [e.g. 2.76.0]

Additional context
Downgrading to 2.75.3 fixes the problem.

@glopesdev glopesdev added the bug A bug to fix label Apr 12, 2024
@filzrev
Copy link
Contributor

filzrev commented Apr 12, 2024

@glopesdev
Are you using redirection entry in xrefmap.json?.
If so. it'll be fixed by #9832. (Fix wrong XRefMapRedirection.cs Href attribute that introduced)

It's expected be released same timing with #9824 changes.
But it's not merged yet. (Because I've mixed bugfix in perf optimization PR)

If it's not using redirection entry.
It's expected to be caused by #9824 changes.

Please provide example xrefmap that cause problems.

@glopesdev
Copy link
Author

glopesdev commented Apr 12, 2024

@filzrev this doesn't use redirection (or at least not intentionally. I didn't even know this feature existed until now), both projects use mostly default docfx settings.

Example xrefmap: https://horizongir.github.io/ZedGraph/xrefmap.yml

@filzrev
Copy link
Contributor

filzrev commented Apr 12, 2024

@glopesdev
Where is the externaldomain setting is defined?

It seems xrefmap define href as relative URL. and no baseUrl setting is defined.
So it's expected behaviors that are resolved to mydomain based URL.

@glopesdev
Copy link
Author

glopesdev commented Apr 12, 2024

@filzrev I have updated the issue to clarify that externaldomain is part of the example resolved URL, and not a setting. The external websites and xrefmap.yml were generated by DocFX built with default settings.

So it's expected behaviors that are resolved to mydomain based URL.

I am not sure I understand the rationale for this. These are not local xrefmap.yml files, they are added as external additional references using a URL which is outside of the domain, so why should they be assumed to be part of the local project?

Also if this is the case then there is a breaking change which should be documented more clearly since as I mentioned in the issue the behavior changes if we downgrade to 2.75.3 where these external references are resolved correctly to the external website URL.

@filzrev
Copy link
Contributor

filzrev commented Apr 12, 2024

Thanks for your reply.

I've confirmed it can reproduce problems when specify xrefmap with URLs.

It's regression introduced by my PR commit.
And it occurred when following conditions met.

  1. Specify xrefmap with URL
  2. Xrefmap don't define baseUrl. And using relative URL for href.

Previous implementation converting all hrefs when file is downloaded.
And my PR commit changes this behaviors. (Changes to rewrite URL on docfx download command)

I'll create fix PR later as soon as possible with relating tests.
Sorry for any inconvenience caused by regression.

gimlichael added a commit to codebeltnet/shared-kernel that referenced this issue Apr 13, 2024
yufeih pushed a commit that referenced this issue Apr 14, 2024
filzrev added a commit to filzrev/docfx that referenced this issue Apr 14, 2024
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix
Projects
None yet
Development

No branches or pull requests

2 participants