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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docgen: Add basic handling for the @since
tag
#43550
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gziolo
added
[Package] Docgen
/packages/docgen
[Package] Core data
/packages/core-data
[Type] Enhancement
A suggestion for improvement.
[Type] Developer Documentation
Documentation for developers
labels
Aug 24, 2022
gziolo
force-pushed
the
update/docgen-print-since
branch
from
August 24, 2022 07:47
d0581ea
to
938960e
Compare
gziolo
changed the title
Docgen: Add basic handling for the @since tag
Docgen: Add basic handling for the Aug 24, 2022
@since
tag
adamziel
approved these changes
Aug 24, 2022
Size Change: 0 B Total Size: 1.24 MB 鈩癸笍 View Unchanged
|
Let's give it a try. |
This is awesome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Package] Core data
/packages/core-data
[Package] Docgen
/packages/docgen
[Type] Developer Documentation
Documentation for developers
[Type] Enhancement
A suggestion for improvement.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
WordPress core has this good practice of including
@since
PHPDoc comment for every file, class, method, field, function, and additional param introduced. It isn't that well-established practice in JSDoc comments, but you can find instances like:https://github.com/WordPress/wordpress-develop/blob/b351a2f05805cf2d8b9ee431020abbe692b8fb36/src/js/_enqueues/admin/media-upload.js#L9
It's unrealistic to bring the same level of details to the Gutenberg project. However, it would be great if we could annotate important new public APIs once they get stabilized, and we know the exact version when they land in WordPress core.
I used the API from
@wordpress/core-data
that got stabilized lately for exploring the idea.Why?
This is what WordPress core uses to help developers identify changes applied to the public API.
Example: https://developer.wordpress.org/reference/functions/register_block_type/
How?
Adds a new section in the generated documentation for public APIs when
@since
gets detected in the code:The only challenge is to come up with a good convention that ensures that it's clear whether
@since
applies to the WordPress, Gutenberg, or the package version 馃槄