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

Add a versions dropdown to the html sidebar #970

Merged
merged 14 commits into from
Feb 9, 2019
Merged

Add a versions dropdown to the html sidebar #970

merged 14 commits into from
Feb 9, 2019

Conversation

michallepicki
Copy link
Contributor

@michallepicki michallepicki commented Feb 7, 2019

  • add javascript_config_path config
  • generate versions dropdown using javascript when versionNodes is defined

Closes #964

edit: now you can try it on hexdocs

* add `javascript_script_path` config
* generate versions dropdown using javascript when `versionNodes` is defined
lib/ex_doc/config.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
lib/mix/tasks/docs.ex Outdated Show resolved Hide resolved
eksperimental and others added 8 commits February 7, 2019 19:16
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
Co-Authored-By: michallepicki <michallepicki@users.noreply.github.com>
@michallepicki
Copy link
Contributor Author

We will probably need to test if the version dropdown looks good on all browsers (I tested Chrome and Firefox on Linux and while there are slight differences, it looks OK).

Also for generating the dropdown and options I just stitched together some functions and jQuery but I saw that we have some fancy templates - we could use them instead.

@josevalim
Copy link
Member

Also for generating the dropdown and options I just stitched together some functions and jQuery but I saw that we have some fancy templates - we could use them instead.

Good call. It looks like the template can cleanup that part considerably. Could you please give it a try? :D

@michallepicki
Copy link
Contributor Author

@josevalim done

assets/js/versions.js Outdated Show resolved Hide resolved
@michallepicki
Copy link
Contributor Author

michallepicki commented Feb 8, 2019

I tried out a few browsers that I have access to and overall the feature works everywhere.

One issue that I see with the current styling is that the dropdown arrow is placed slightly differently (the gap between version number and the dropdown arrow is different). The biggest difference is between Firefox and Chromium. I don't think this is a big issue even though I am one of the very few people using Firefox on Android.

Firefox 65 Android:
firefox_android
Firefox 65 Linux:
firefox
Chromium 71 Linux:
chromium
Edge 17 Windows 10:
edge
IE 11 Windows 10:
ie
Safari 11 macOS High Sierra:
safari

Additional issue on IE 11 is not supporting CSS initial value. We could just set the text color to black there but I'm not sure how it would work on systems with dark system theme. Similarily, I don't think this is a big issue and I would leave it as it is. The text is still visible on mouse hover.
ie_drop

@Gazler
Copy link
Contributor

Gazler commented Feb 8, 2019

Tries demo

*Clicks asdf* 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢 😢

@OvermindDL1
Copy link

Tried the demo, not seeing a dropdown element at all? I'm in elinks and I can normally access dropdowns just fine.

@michallepicki
Copy link
Contributor Author

michallepicki commented Feb 8, 2019

@OvermindDL1 Just to be clear, it doesn't work for you on elinks with javascript compiled in and enabled, right?

edit: @Gazler Fine, I removed it

@OvermindDL1
Copy link

OvermindDL1 commented Feb 8, 2019

@michallepicki I'm using ubuntu's and redhat's stock elinks, which I don't think do (although I could compile elinks myself for my home computer, at work I'm restricted to the redhat repo's for software installation except in very few pre-approved situations):

Ubuntu Features:
Standard, IPv6, gzip, bzip2, UTF-8, Periodic Saving, Viewer (Search
History, Timer, Marks), Cascading Style Sheets, Protocol
(Authentication, File, CGI, Finger, FSP, FTP, HTTP, URI rewrite, User
protocols), SSL (GnuTLS), MIME (Option system, Mailcap, Mimetypes
files), LED indicators, Bookmarks, Cookies, Form History, Global
History, Scripting (Lua, Perl), Goto URL History

RedHat Features:
Standard, IPv6, gzip, bzip2, UTF-8, Periodic Saving, Viewer (Search
History, Timer, Marks), Cascading Style Sheets, Protocol
(Authentication, BitTorrent, File, FTP, HTTP, URI rewrite, User
protocols), SSL (OpenSSL), MIME (Option system, Mailcap, Mimetypes
files), LED indicators, Bookmarks, Cookies, ECMAScript (SpiderMonkey),
Form History, Global History, Scripting (Spidermonkey ECMAScript), Goto
URL History

The redhat one lists ECMAScript (SpiderMonkey) but the dropdown box doesn't appear there either, just a static-text version string.

Though the 'expandable menu' doesn't work either, just refreshes the page when I try to access one of them. They really should be embedded lists that are just hidden and shown as desired using pure CSS (I do the same on my sites and they work just fine for 'expandable menus' identically to ex_doc's, except it always shows them all in elinks, meaning they actually work, there's no need for javascript on those...). But that's a side issue anyway.

Optimally, since I tend to be GUI-less much of my workday, I'd really really like programming documentation to actually fully work in a text browser or a simple curl ... | html_to_text | less for at least reading or so, which means no required javascript on things that can be done via standard methods, like expandable menu's can be done purely via html+css (even works on IE11 as I have to test for that at work).

@michallepicki
Copy link
Contributor Author

@OvermindDL1 As mentioned in the PR description:

  • add javascript_config_path config
  • generate versions dropdown using javascript when versionNodes is defined

The main goal here is not having to regenerate old documentation when a new package version is published.

Maybe we could use some JavaScript polyfills for this SpiderMonkey version, or maybe instead we could use an iframe? I'm not sure.

@josevalim josevalim merged commit e16b91e into elixir-lang:master Feb 9, 2019
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@josevalim
Copy link
Member

Now we just need to implement this on Hex side of things. :D

@michallepicki michallepicki deleted the version-dropdowns-pr branch April 3, 2019 21:19
matlc pushed a commit to matlc/ex_doc that referenced this pull request Apr 4, 2019
author Michał Łępicki <michallepicki@users.noreply.github.com> 1546725776 +0100
committer Mat Clutter <matclutter@gmail.com> 1554419584 -0400
gpgsig -----BEGIN PGP SIGNATURE-----

 iQIzBAABCAAdFiEEsM4qAF+pTkg2/b7aTIOp6Pcx4e4FAlymj4AACgkQTIOp6Pcx
 4e5C4RAAr+0863jpjah1JcSKz6LBAR341VnwWSccn1ndvT8kohpFaogIqBh2luP1
 iDCq6ZHNHviNoD/YrZDUfFbtcShSD70gCba5l2W2+QItQ7ncm1TGPC5iXi6wi+Cx
 VqrYPSedHNlkUNQEphePTj0a+7S16sZWgZZo74nKQL2jpbnEHQfQBMn3LeLVY749
 M8LqePTPzpctEYqqFWuWhOM3HcWhZyZqR+eqJDbJPhIY0HwvmtL0+Hh/TzIYmBV2
 UhMfQ2Xl2ZMPQsQpmdP8RuqyEE5FbUkY6eyZOw4FLPFt0gGqVlvWaUscFxzG5Jd9
 B1siUUTIv9ghONyO5QlUJigAsMcFqBr27tOWW+qLsPvScR0LEneC/Fc71JvZsTsY
 b/CopfkzVNNNlgx9RYyp4zK00+E8aPqPUxvPLjusymcOmUTP/CxoGZjJY5+xroIp
 AVoL9j994ujM8Qs1IZo2gw6wXgi5NXgn6Tbu/Dy8mWDbShdqQu641K5anlya5A9S
 MkGYUZ2EeeHAYY8nj6HuIqmOvd23K1jz8uX0oqtDcu2T4K7PH1w81T00pwBwekhC
 3CdiLbq0z2aWCfNl8O4/SapMbWIoYbZC6Z8oCrRjSzqQl1qyJQiHX7BunMpQd0zu
 sqjN+7s6mXxG33Qwkk3shOCLgPiF2sCvEnqF82Al3gWmphjcMEs=
 =m5NQ
 -----END PGP SIGNATURE-----

Unify code styling for makeup and hljs (elixir-lang#959)

Fix anchor links sometimes not working by moving js to html head (elixir-lang#962)

Raise error message for unknown docs chunk

Add goto icon

Fix sidebar margin on Firefox

Allow direct external links on the sidebar

* Clicking on the sidebar now consistenty expands the menu

* However, on every root link, there is now an arrow to open
  the page directly

* If shift is pressed, we keep the browser behaviour

* Improve CSS classes: clicked is now currentPage and active
  is now currentHash

Hide formatter modules

Release v0.19.3

Remove broken link

Always show link

Add extra padding

Use the goto arrow consistently on expansions

Reduce hljs FOUC to colors only (elixir-lang#960)

Fix typespec arg number (elixir-lang#966)

Previously signature where typespecs didn't have an argument name,
were named starting with 0

time_zone_period_from_utc_iso_days(arg0, arg1)
time_zone_period_from_utc_iso_days(Calendar.iso_days(), Calendar.time_zone()) :: ...

this commit fixes the number starting from 1

Name args in Autolink.default_text/4 helper (elixir-lang#957)

Add titles to sidebar top-right icons

Improve mouseover and titles on goto, related to elixir-lang#968

Add a versions dropdown to the html sidebar (elixir-lang#970)

Remove overflow on content, closes elixir-lang#972

Reduce size of app-vsn annotation

Keep trailing periods in summaries (elixir-lang#977)

Closes elixir-lang#975

Revert "Remove overflow on content, closes elixir-lang#972"

This reverts commit 43effcb.

The reverted commit breaks anchors on Firefox.

Fix anchors in Firefox/Chromium

Closes elixir-lang#978

Added ARIA-label to the search button

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>

Add keyboard shortcuts (elixir-lang#976)

Fix issues with JS events under non-webkit browsers (elixir-lang#980)

Keyboard shortcuts - improvements (elixir-lang#982)

Add module to node structs to carry module name; add mfa into title attribute on links to improve seo

Fix tests to include title

Run formatter

Remove module attribute on nodes; update templates to pass in module to reference title where needed

Remove 'Link to' text except for detail chain link and screenreader info

Update tests to remove Link to text from api and non-detail templates

Undo unintentional format of spacing

Remove link to text from title attributes

Update css/js with new sha version

Add title attribute with mfa on links to improve seo

Add module to node structs to carry module name; add mfa into title attribute on links to improve seo

Remove 'Link to' text except for detail chain link and screenreader info

Undo unintentional format of spacing

Add title attribute with mfa on links to improve seo

Update title in detail template examples

Add title to replace function for links in text

Update auto link to add titles to links within page content and specs

Add module_id into default_title to add full mfa to local functions

Lowercase section headings in titles

New dist files after running build after rebase accumulation

Remove rebased-in code

Update module details and search results

Create seperate entry function for extras headings; change casing on summary

Update templates and tests to remove tags from titles

Change binary block formatting keep formatter from breaking lines

Full text search (elixir-lang#974)

Fix required double click on sidebar for safari

Improvements to full text search

* Add loading state
* Only load search items on search page

No longer depend on Poison

Move shared dependency to HTML

Do not render to markdown multiple times

Make the linter happy

Ignore : in search as it is not stemmed anyway, closes elixir-lang#983

Provide search help on invalid syntax

Remove double var

Keep structs in signature, closes elixir-lang#973

List delegation docs if delegate_to metadata is present

Run the formatter in released Elixir version

Update CHANGELOG

Search autocomplete (elixir-lang#985)

Rename config.js to ex_doc_config.js

Push Earmark to v1.3 (elixir-lang#988)

Add module to node structs to carry module name; add mfa into title attribute on links to improve seo

Run formatter

Remove module attribute on nodes; update templates to pass in module to reference title where needed

Remove 'Link to' text except for detail chain link and screenreader info

Undo unintentional format of spacing

Update css/js with new sha version

Add title attribute with mfa on links to improve seo

Add module to node structs to carry module name; add mfa into title attribute on links to improve seo

Remove 'Link to' text except for detail chain link and screenreader info

Undo unintentional format of spacing

Add title attribute with mfa on links to improve seo

Add module_id into default_title to add full mfa to local functions

Lowercase section headings in titles

New dist files after running build after rebase accumulation

Remove rebased-in code

Update module details and search results

Create seperate entry function for extras headings; change casing on summary

Update templates and tests to remove tags from titles

Change binary block formatting keep formatter from breaking lines

Add link_title to new searchItems list

Update earmark after deps.get

Update css/js assets after mix build

Update css/js assets after mix build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants