-
Notifications
You must be signed in to change notification settings - Fork 4.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
JavaScript Documentation: Improve the JS API documentation tool. #61036
Comments
cc @juanmaguitar for awareness, as we talked about this the other day. Ideally, we should aim to incorporate the JavaScript APIs to The Reference, that only contains PHP for now. The Reference provides a lot more (focused search, list changes by WordPress version, etc.) and is the centralized place for this kind of thing. This track ticket contains references to past efforts https://meta.trac.wordpress.org/ticket/3063 For context, there are two pieces at work here:
|
For clarity, I'm not really opinionated on how we implement this. The only requirement I have technically is that the code base and the documentation stay together (in the code base), how it's generated and published is implementation detail. |
Would it help to have a minimum scope for what a single page for an item would contain? As well as what we intend it to apply to? E.g. components have been mentioned but does it make sense to include packages given they sort of already have that in the handbook? |
I have been discussing this issue with @oandregal, and we concluded that the following actions could make a good plan of action to move this issue forward:
This work would affect code at the following repos:
This plan would enable the same functionality for JavaScript (JS) functions available for PHP functions at https://developer.wordpress.org/reference/functions. It would also allow for distinguishing between JS functions and PHP functions. After this first milestone, we could expand the functionality of this process to also include relationships between JS functions in the same way we have them for PHP functions. |
At WCEU @juanmaguitar and @adamziel and I discussed calling out to the TypeScript language server from the This would allow the PHP code to generate the docs from the JS files and make a clean integration - the JS process wouldn't have to match formats, the would be no JS side to this at all. Language server calls are XML-RPC calls over HTTP so shouldn't be a technical obstacle on the PHP side. We can iterate over all the files, get all the symbols, get all the docblocks attached to them, and get the inferred types whether JS or TS. I think this is a valuable avenue to explore as it collapses a lot of complexity into a project that already understands the Gutenberg codebase enough to provide IDE inline documentation, jumping, and autocomplete - the TypeScript Language Server. As discussed this has interesting tie-ins to using Just wanted to leave the notes so this doesn't get lost as I think it's a viable path to explore to improve our docs generation and simplify it at the same time. |
What problem does this address?
In Gutenberg we use a custom made tool called api-docs to parse the exported JS APIs and document them in the README files of each package and end up in a package in the block editor handbook (useSelect Example).
This is not very different from how the WordPress PHP APIs are extracted and documented on the developer docs.
But there are some subtle differences that make a big difference in terms of results:
What is your proposed solution?
I also believe that some of our JS Docs are not great but having dedicated pages for each API will incentivize developers and documentation contributors to actually submit PRs and improve these. Today, these are hidden within a huge README file.
cc @oandregal @tomjn
The text was updated successfully, but these errors were encountered: