-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Improve styling of parameter tables in the docs #8618
base: main
Are you sure you want to change the base?
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/a34c253ef160c20d2ecd9ed91205141e796d7ae5/gradio-4.37.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@a34c253ef160c20d2ecd9ed91205141e796d7ae5#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-builds.s3.amazonaws.com/a34c253ef160c20d2ecd9ed91205141e796d7ae5/gradio-client-1.2.0.tgz |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
I don't really love this for long types, they are unreadable of which we have many: https://gradio-9e0pzuzft-hugging-face.vercel.app/docs/gradio/annotatedimage I think the ParamViewer offers a better compromise: https://huggingface.co/spaces/pngwn/gradio_imageslider |
@pngwn I can split the types across multiple lines when its a union of types to avoid the issue you're mentioning Stylistically, I think gr.ParamViewer would look out of place on our docs page. And one thing I don't like like about it is how the docstrings are hidden by default -- they should always be visible to make it easier to cmd+f and find what you're looking for |
@abidlabs this looks great, though i wish there was better styling for the Default: / Required part. Maybe keep that as it is currently? |
The proposed styling looks nice! I do think it would be best if we could consolidate the desired "param table style" in the ParamViewer component. That way all parameter tables (custom components, docs, api docs) would be consistent. |
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.
Changes look good to me @abidlabs. I agree with @freddyaboulton that it would be nice to be consistent everywhere.
You have to make the changes to FunctionDoc.svelte as well (like you did for EventListeners.svelte). Right now it's still the old table styling.
![Screen Shot 2024-06-27 at 12 02 41 PM](https://private-user-images.githubusercontent.com/9021060/343874238-5cfe779a-f041-4167-bda8-b461ae68d9ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NDY5NzksIm5iZiI6MTcxOTc0NjY3OSwicGF0aCI6Ii85MDIxMDYwLzM0Mzg3NDIzOC01Y2ZlNzc5YS1mMDQxLTQxNjctYmRhOC1iNDYxYWU2OGQ5YWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MzBUMTEyNDM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzNhMjY5M2RhYjEyNDhjZWI2MGY4YjU5MWZlNjliZWEwOGViMTEyZTc1YTQ2ODIzZTc3MmE5YWNmOWQzZjBjMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.tR2WZWrvk6-xsJGJZq6lwpDaT0jYHHV-akQ3YSaeV_E)
I think don't think the compound/ complex types are really that readable. You can read them now but it is still almost impossible to understand the relationship between the different parts (ie nested bits, unions, etc) without some proper formatting. |
I personally think the docstrings are too long to be visible all of the time, we have too many kwargs for that. If you want to see anything else then you have an awful experience. |
Ok with changing this, but how would you suggest formatting them @pngwn?
I don't think that's the case, you can easily navigate to the different sections using the sidebar on the right. Having all of the docstrings makes it much easier to CMD+F and find what you're looking for. I strongly dislike when documentation is partially hidden as it makes search completely unreliable
Can make this change! |
Change the styling of the parameter tables in the docs to be consistent with the view api docs. Our current design wastes a lot of whitespace when the docstrings are short or very long, forcing users to scroll a lot when e.g. they want to see the example usage
BEFORE:
AFTER: