Skip to content

[Toolkit] Read prop and block docs from Twig documentation comments - #3796

Open
Kocal wants to merge 1 commit into
symfony:3.xfrom
Kocal:toolkit-documentation-comments
Open

[Toolkit] Read prop and block docs from Twig documentation comments#3796
Kocal wants to merge 1 commit into
symfony:3.xfrom
Kocal:toolkit-documentation-comments

Conversation

@Kocal

@Kocal Kocal commented Aug 19, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? yes
Docs? no
Issues -
License MIT

Depends on #3795, twig/twig >= 3.29

The Toolkit now documents kit props and blocks with Twig 3.29's documentation comments instead of the old {# @prop #} / {# @block #} docblocks, and reads them natively instead of parsing them with regular expressions.

Prop type and description come from PropsNode::getPropDocumentation(). Block descriptions are read by tokenizing the template and pulling the documentation attached to each {% block %}, block(outerBlocks.x) or block('x') token. The linter (ComponentDocChecker), the parser, the create-kit scaffold and the kit authoring skill have all been updated to match.

All 254 kit component templates are migrated to the new syntax as part of this PR.

The migration is byte-neutral: no snapshot changes, and all kits still lint clean. Block comments sit on their own line above the block and mirror its whitespace-trim ({##- ... -#} when the block opens with {%-/{{-, {## ... -#} when it opens with {%/{{), so they never change the rendered whitespace.

This depends on #3795 and needs Twig 3.29, so it should be merged after that one.

@Kocal
Kocal force-pushed the toolkit-documentation-comments branch 2 times, most recently from b78bf20 to 6ad67fb Compare August 19, 2026 20:13
@Kocal

This comment was marked as low quality.

@Kocal
Kocal force-pushed the toolkit-documentation-comments branch 2 times, most recently from 33cea21 to b16bf31 Compare August 24, 2026 11:36
@Kocal
Kocal marked this pull request as ready for review August 24, 2026 11:37
@carsonbot carsonbot added Feature New Feature Toolkit Status: Needs Review Needs to be reviewed labels Aug 24, 2026
@Kocal
Kocal force-pushed the toolkit-documentation-comments branch from b16bf31 to e6a3c78 Compare August 24, 2026 11:37
@Kocal

Kocal commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Waiting for Twig 3.29, and VincentLanglet/Twig-CS-Fixer#461 for making Fabbot happy

@Kocal
Kocal force-pushed the toolkit-documentation-comments branch from e6a3c78 to 9902262 Compare August 24, 2026 11:59
The Toolkit used to parse `{# @prop #}` and `{# @block #}`
docblocks with regular expressions. It now reads the same
information straight from Twig's own documentation comments.

Prop type and description come from the new
`PropsNode::getPropDocumentation()` method exposed by
TwigComponent. Block descriptions are read by tokenizing the
template and pulling the documentation attached to each
`{% block %}`, `block(outerBlocks.x)` or `block('x')` token.

This bumps `twig/twig` to `^3.29` and `symfony/ux-twig-component`
to `^3.5`, and updates the linter (`ComponentDocChecker`), the
parser, the `create-kit` scaffold, the kit authoring skill, and
the tests accordingly.
@Kocal
Kocal force-pushed the toolkit-documentation-comments branch from 9902262 to acf606d Compare August 30, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New Feature Status: Needs Review Needs to be reviewed Toolkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants