The Jetpack team launched developer.jetpack.com this week, a searchable code reference for actions, filters, and features found in the plugin. Although Jetpack is developed to be highly extensible, up until now there was no centralized place for developers to find documentation. The reference features new hooks added in the most recent version and can also be toggled to other versions.
As the search feature does not yet have autocomplete, developers will need to enter the exact hook they want to query, because anything not found in the reference will return no results. Searching general terms or Jetpack features will turn up a list of hooks to hunt through. The reference could benefit from pagination or infinite scroll on results, but its basic features are much better than the alternative of having to search through the codebase yourself. Results list a hook’s available parameters and many include usage examples.
According to Jetpack team member Jeremy Herve, the site was modeled after the WordPress code reference.
“It uses the same parser to generate documentation from the plugin’s codebase, and its goals are similar: provide some information to folks who want to know more about a specific hook, or want to know how to customize specific aspects of Jetpack,” Herve said.
Herve and other team members have written many posts with code snippets and most recently the Hook of the Month series, but beefing up the inline documentation took up the bulk of the time in launching the new reference.
“When building that code reference, the hardest part was probably to go back and review all the codebase, to add inline documentation,” Herve said. “That’s what took us the most time.”
The Jetpack team plans to improve the search function and is considering adding autocomplete. They are also working to add more unique content and code samples for the hooks, as not all of them are fully documented yet. This content will demonstrate best practices for extending Jetpack.
“Right now, I think one of the first things we’re interested in is getting feedback from developers: do they find this useful, what’s missing, what can we improve?” Herve asked. Reviewing an example filter like jetpack_open_graph_tags gives you an idea of the type of content the team is hoping to provide for more hooks. Feedback is welcome on the announcement or via the Jetpack support form.