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

docs: display class properties and methods in search results #21885

Closed
wants to merge 19 commits into from

Conversation

CodyJasonBennett
Copy link
Contributor

@CodyJasonBennett CodyJasonBennett commented May 24, 2021

Related issue: #19342
Continues: #21674

Description

This pull request creates a script to auto-generate docs/files.json with class methods and properties enumerated. These are integrated into search results to create marcofugaro's suggested search UI and be consumed by three's Discord bot.

As per marcofugaro's UI, when you search you will find both classes and their methods. Since that may clutter up results unnecessarily, I've opted to allow users to filter using modifiers.

  • Queries in PascalCase will search only for sections/classes (when combined with other modifiers, results will only display for a matching section/class)
  • . filters to class methods and properties (can be used as a prefix or combined with class names)
  • # filters to class methods (can be used as a prefix or combined with class names)

Demo: https://raw.githack.com/CodyJasonBennett/three.js/generate-docs/docs/.

Enhanced.Search.mp4

@CodyJasonBennett CodyJasonBennett changed the title Create script to autogenerate docs/list.json, methods & properties. Docs: auto-generate docs/list.json with methods & properties. May 24, 2021
Copy link
Contributor Author

@CodyJasonBennett CodyJasonBennett left a comment

Choose a reason for hiding this comment

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

Maybe we should mirror this for examples (#20207).

@CodyJasonBennett CodyJasonBennett changed the title Docs: auto-generate docs/list.json with methods & properties. Docs: auto-generate methods & properties in docs/list.json May 25, 2021
@mrdoob
Copy link
Owner

mrdoob commented Aug 10, 2021

Sorry, this got lost...

Is there a way to see it live? I'm trying this:
https://raw.githack.com/CodyJasonBennett/three.js/generate-docs/docs/

@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented Aug 10, 2021

I'm not sure how I closed this but I can integrate this into the UI.

@CodyJasonBennett CodyJasonBennett changed the title Docs: auto-generate methods & properties in docs/list.json Docs: auto-generate methods & properties Aug 10, 2021
docs/index.html Outdated Show resolved Hide resolved
@CodyJasonBennett CodyJasonBennett changed the title Docs: auto-generate methods & properties docs: display class properties and methods in search results Aug 10, 2021
@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented Aug 11, 2021

@mrdoob, that link is now live.

@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented Aug 12, 2021

I touched up a bit on the search ergonomics in f285cd4 which should better the search UX with this enhancement (see top comment).

@octopoulos
Copy link
Contributor

octopoulos commented Sep 15, 2021

I just saw this PR. I think we should try to combine it with the code I did a few days ago, which accelerates the search by a nice factor. What do you think? The timeout code that you added wouldn't be necessary as it would be able to run in real time.

@CodyJasonBennett
Copy link
Contributor Author

@octopoulos, for sure, and thanks for that.

@octopoulos
Copy link
Contributor

Then I guess I'm going to merge your first commit, the one that creates the files.json, and modify it a bit too to compress the file.
For example, if the URL can be inferred automatically, then I'll skip it, and the docs in other languages than EN don't need to duplicate the data.
As for the docs/index and examples/index, I don't know if everyone will like it, but I'll make them be exactly the same files, that will import a script.js that does both docs and examples, that way, if we switch between docs/examples by clicking on the top links, the switch will be instant since it will stay on the same page and no further preprocessing (loading) will be required.

@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented Sep 15, 2021

You might want to have that in a separate PR to facilitate design feedback regarding the proposed UI; don't want that to block the current improvements you made.

@octopoulos
Copy link
Contributor

octopoulos commented Sep 15, 2021

Yeah, I'm going to make another PR. I guess it will be ready by tomorrow.
Btw, I already did the "shorter" list system, it went from 44kb to 16kb :)

@CodyJasonBennett
Copy link
Contributor Author

Awesome. I'll close this as we're continuing in #22542.

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.

3 participants