Conversation
There was a problem hiding this comment.
Pull request overview
This pull request improves documentation visuals for Flowbite component documentation by introducing a standardized "example" preview method pattern, reorganizing docstrings for better visual presentation, and refactoring the documentation rendering system with new helper classes and view components.
Changes:
- Adds an "example" method to preview files (ButtonPreview, CardPreview, ToastPreview, InputPreview, InputFieldPreview, BreadcrumbPreview, LinkPreview) to provide a default visual example that appears at the top of component documentation
- Refactors documentation rendering with new
Yard::CodeObjectmodel wrapper,FormattingHelper::DocstringRendererclass, andDocs::Headlinecomponents (H1-H4) - Reorganizes component docstrings to move
@seetags after@exampletags for improved visual flow
Reviewed changes
Copilot reviewed 28 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| demo/test/components/previews/*.rb | Adds "example" methods and renames some existing methods for consistency |
| demo/app/views/docs/components/show.html.erb | Major refactoring to separate introduction from body content and render examples prominently |
| demo/app/models/yard/code_object.rb | New model wrapper for YARD code objects with docstring splitting methods |
| demo/app/models/yard.rb | New module for YARD registry access |
| demo/app/helpers/formatting_helper.rb | New helper with DocstringRenderer class replacing the deleted markdown_helper |
| demo/app/controllers/docs/components_controller.rb | Refactored to use new Yard module and add preview finding methods |
| demo/app/components/docs/headline/*.rb | New components for consistent heading rendering |
| demo/app/components/docs/code_example.rb | New component for code example rendering |
| demo/Gemfile | Adds rails_autolink dependency |
| app/components/flowbite/*.rb | Documentation improvements (moved @see tags, removed blank lines) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Seeing an example of the component is pretty important for the documentation, so this change looks for a Lookbook preview with a scenario named "example" and renders it as part of the introduction section.
This makes it more scannable and allows us to show the scenario label as a heading for each example.
Show, don't tell. If people want the nitty-gritty API details, they can scroll to the bottom. The top should focus on usage and examples.
This should make it easier to adjust docstring rendering in the future.
This should make it possible to rely on our docs being rendered roughly the same way in both rdocs and our own demo app.
We format code comment blocks with max 80 characters per line. This means that each line ends in a line break which appears in the docstring, thus is converted to <br> tags by the markdown renderer. To improve the rendering of such docstrings, we remove these line breaks after the markdown rendering step.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 30 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This seems to be the proper way to get the class name of a preview
No description provided.