-
-
Notifications
You must be signed in to change notification settings - Fork 685
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
Add a basic version selector to rendered documentation #846
Add a basic version selector to rendered documentation #846
Conversation
Very cool to see! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I left a comment inline.
@@ -5,11 +5,13 @@ | |||
<meta name="viewport" content="width=device-width" /> | |||
<title>{{ page_title }}</title> | |||
<link rel="stylesheet" href="{{ unnest }}/index.css" type="text/css" /> | |||
<script src="{{ unnest }}/docs_config.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this file get automatically added by hexdocs? If so can we add a comment here to explain that.
@lpil What do you think about the project version in the toml version file? Should it be required? There is a duplication with the .app file, and I don't know what rebar3_hex uses - I think it would be good for the library maintainer to configure current version in one spot |
Alternatively, I can not use the current package version at all, have an empty span in place and only fill it in with a dropdown if the |
In Michael's pull request I was suggesting that it was made mandatory and a check is added to ensure that the version in What do you think? |
I like the idea! I will try to get something working, I don't know much Rust but I always wanted to learn more about it |
If @michaeljones gets around to it sooner then that's fine as well and I can update this PR accordingly. |
I'm not working on anything yet. Might have a bit of time today but there
are other things to address on my PR too so happy for someone else to
tackle that!
|
One more thing I'll note here so that I won't forget: ExDoc currently also tries to redirect to the same page. They do that by splitting the current URL by slashes, taking just the last (file) part and appending it to chosen version URL. Then they do an AJAX call first, and if it succeeds, they navigate to that page. If it fails, they navigate to just the version URL. code I did not include this here because Elixir has a flat documentation file structure and Gleam has files nested in subdirectories. Also I think it's kind of a hack. But it works so maybe if I don't come up with anything better, I will include something similar here. |
Thanks for the info @michallepicki . I agree it's not clear exactly what the best approach for that is yet. Let's hold off for now and tackle that later. |
</head> | ||
<body> | ||
<header class="page-header"> | ||
<h2> | ||
{{ project_name }}<!-- - {{ project_version }} --> | ||
{{ project_name }} | ||
<span id="project-version"> - v{{ project_version }} </span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about that, do we want to show the version now whenever the docs_config.js
wasn't loaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good. We can always improve it later :)
Updated, should be ready for review now! To test this, after generating docs, I was downloading the |
The appearance on Chrome should now be better. I used an svg background to style the dropdown because with the |
Published something temporarily to https://michallepicki.github.io/otp/ for testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! This'll be a big usability improvement going forward. Thanks!
Good find. Thank you |
Adds dropdown to switch to a different package version. Closes #844