-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make functions in docs filterable #2514
Conversation
The input seems a bit out of place (at least on FF 45, on Chromium it's OK). Could be cool to add it a width: 80% or something like this. Except this 👍 very nice work. |
With a utility library like Underscore, it is very common to open the docs with the aim of locating the documentation for a specific function. Currently I use my browser's search functionality, but since many functions reference other functions, I frequently have to cycle through multiple matches before I arrive at the actual function's description. This patch aims to improve this common use case by offering a "filter" input above the list of functions. As a user types, the list of functions (and section titles) is reduced, leaving only the matching functions. If the user presses enter, they are jumped to the documentation for the first matching function. This functionality (and implementation) is greatly inspired by the implementation that is included in the [Ramda docs](http://ramdajs.com/0.21.0/docs/). You can read their source code [here](https://github.com/ramda/ramda.github.io/blob/master/main.js)
@Florian-R Good idea. Added. |
👍. Someone else want to weigh in? |
I'll merge this later today, unless somebody objects. |
There are some merge conflicts between this PR and the |
Because the "Functions" section heading already uses `#functions` the individual method uses an irregular id. I missed this in jashkenas#2514.
I've cherry-picked this over to |
Because the "Functions" section heading already uses `#functions` the individual method uses an irregular id. I missed this in #2514.
This might be the best thing to ever happen to underscore. |
This is super nice! @captbaritone — Would you be interested in adding the same functionality over on the Backbone docs? |
@jashkenas Glad you like it! @msrose and I will take a look at porting it to Backbone. |
With a utility library like Underscore, it is very common to open the docs with the aim of locating the documentation for a specific function.
Currently I use my browser's search functionality, but since many functions reference other functions, I frequently have to cycle through multiple matches before I arrive at the actual function's description.
This patch aims to improve this common use case by offering a "filter" input above the list of functions. As a user types, the list of functions (and section titles) is reduced, leaving only the matching functions. If the user presses enter, they are jumped to the documentation for the first matching
function.
This functionality (and implementation) is greatly inspired by the implementation that is included in the Ramda docs.
You can read their source code here
To aid in review, you can find try out the functionality here: https://rawgit.com/captbaritone/underscore/search/index.html
Possible Improvements