Skip to content

Fix documentation/image links #4025

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

Merged
merged 2 commits into from
Jan 30, 2024
Merged

Conversation

jhrcek
Copy link
Collaborator

@jhrcek jhrcek commented Jan 29, 2024

I built the docs locally and fixed most sphinx warnings.

@jhrcek jhrcek requested a review from michaelpj as a code owner January 29, 2024 18:43
@@ -284,7 +284,7 @@ Convert a datatype to GADT syntax.

![GADT Demo](../plugins/hls-gadt-plugin/gadt.gif)

![Link to Docs](../plugins/hls-gadt-plugin/README.md)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are not images (which is what ! syntax in markdown represent) but just plain links.

I'm trying to unbreak "broken link" appearance in places like this
Screenshot from 2024-01-29 19-42-43

@@ -221,7 +221,7 @@ Run the benchmarks with `cabal bench`.

It should take around 25 minutes and the results will be stored in the `bench-results` folder. To interpret the results, see the comments in the `bench/Main.hs` module.

More details in [bench/README](../../bench/README.md)
More details in [bench/README](https://github.com/haskell/haskell-language-server/blob/master/bench/README.md)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These links are referring to stuff outside of docs directory, so sphinx is unable to create proper links.
Rather than trying to change sphinx configuration, i think it's simpler to just link to relevant docs on master branch..?

Copy link
Collaborator

Choose a reason for hiding this comment

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

will it cause a version mismatch though🤔

Copy link
Collaborator Author

@jhrcek jhrcek Jan 30, 2024

Choose a reason for hiding this comment

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

Let's think through the implications of this change:

  1. Before this PR, the links (not images, which are copied during the build!) that point to relative file paths outside of docs directory are not rendered as links:
    Example: search for bench/README on this page.

When building the docs by running make html in the docs folder I get get the following warning:
/home/jhrcek/Devel/github.com/haskell/haskell-language-server/docs/contributing/contributing.md:224: WARNING: Unknown source document '/home/jhrcek/Devel/github.com/haskell/haskell-language-server/bench/README' [myst.xref_missing]

And the resulting html has no links:
Screenshot from 2024-01-30 05-34-52

  1. With this PR: the link is renered correctly and points to readme on master:
    Screenshot from 2024-01-30 05-40-02

You're right that this is not ideal, because the readme on master can be modified in a way that makes is "incompatible" with the rendered version of the docs or it can be even removed etc. But this is what most of the other links on the page are currently doing (just pointing to master version of the doc on github).

3)The ideal solution would be to replace "master" within those links with "the commit hash of the commit from which the docs were built" which would tie the rendered docs to the state of the repo when they were built. Unfortunately I don't know what's the "canonical" way to do this with sphinx (I can only think of hacks like adding a placeholder in all those links and running sed -i /PLACEHOLDER/$(git-rev parse HEAD)/g before building with shinx, which feels like hack). I'm open to suggestions how to implement such a thing correctly 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for things that have a relatively stable location what you're doing here is okay. In particular, I could imagine replacing this link with the prose "the readme for the benchmarks", which would direct people to the same place. If anything, I'd be tempted to just use the prose.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

General direction is great, thanks!

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for taking care of the Docs!

@jhrcek jhrcek merged commit 4b69dfb into haskell:master Jan 30, 2024
@jhrcek jhrcek deleted the jhrcek/fix-doc-links branch February 2, 2024 04:04
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