-
-
Notifications
You must be signed in to change notification settings - Fork 388
[Toolkit] Add support for documenting props/blocks API #3154
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
Conversation
e6d8290 to
ada069d
Compare
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.
Pull Request Overview
This PR adds automatic API reference documentation generation for Twig components. The system parses special comment annotations (@prop and @block) in component templates to generate API documentation tables showing available props and blocks.
- Implements
renderApiReference()method that extracts API annotations from Twig templates using regex patterns - Integrates API reference section into component documentation pages
- Adds CommonMark table extension support with responsive styling
Reviewed Changes
Copilot reviewed 77 out of 78 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ux.symfony.com/src/Service/Toolkit/ToolkitService.php | Adds renderApiReference() method to parse @prop and @block annotations from Twig files and generate markdown tables |
| ux.symfony.com/src/Twig/Components/Toolkit/ComponentDoc.php | Integrates API reference generation into component documentation content |
| ux.symfony.com/src/Service/CommonMark/ConverterFactory.php | Adds TableExtension and DefaultAttributesExtension to support markdown tables with responsive wrapping |
| ux.symfony.com/assets/styles/components/_Wysiwyg.scss | Adds styling for responsive table containers |
| ux.symfony.com/composer.json | Adds symfony/string dependency |
| src/Toolkit/kits/shadcn//templates/components/.html.twig | Adds @prop and @block annotations to component templates for API documentation |
| src/Toolkit/kits/shadcn/*/EXAMPLES.md | Updates examples to reflect prop name changes and add new examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,3 +1,5 @@ | |||
| {# @prop variant 'default'|'desctructive' The variant, default to `default` #} | |||
Copilot
AI
Oct 31, 2025
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.
Corrected spelling of 'desctructive' to 'destructive'.
| {# @prop variant 'default'|'desctructive' The variant, default to `default` #} | |
| {# @prop variant 'default'|'destructive' The variant, default to `default` #} |
| ``` | ||
|
|
||
| ## With a 1 / 1 aspect ratio | ||
| ## With 2 / 3 aspect ratio |
Copilot
AI
Oct 31, 2025
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.
Extra space in the heading '2 / 3 aspect ratio' (double space before 'aspect'). Should be single space.
| ## With 2 / 3 aspect ratio | |
| ## With 2 / 3 aspect ratio |
ada069d to
133943b
Compare
Props and blocks now render like that:

I also updated/fixed some examples or components