Open the autodoc API for user-provided plugins #30082
mrginglymus
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I have started to hit the limitations of the two react docgen plugins. Whilst some may be addressed by improving the packages themselves, there are some issues and use cases that would be better served by a more accessible API for users to add their own auto-generated doctypes.
Describe the solution you'd like
I should start with explaining what I currently am doing:-
I have a bespoke documentation extraction script that is tightly coupled to the patterns I use in my library. It is therefore faster and more richly detailed than the off the shelf options, and is generates a static manifest of documentation that is used to drive documentation beyond Story
argTypes
on my storybook (e.g. things like what css classes, css vars, translatable strings are associated with each component).This manifest contains all the information required to automatically drive
argTypes
.However, there is no easy way to plumb this information into storybook with the same level of automation as the autodocs plugin.
What would make at least my life easier, would be an api, perhaps on the
Preview
object, that looked something like:Aside from having greater control over the contents of the argTypes, this also seems to offer a substantial performance increase; computing docTypes is moderately expensive; it is certainly too expensive to be done as often as it is done, given the frequency with which the information changes.
Describe alternatives you've considered
I can see two ways of achieving this currently:
argTypes
to theMeta
definition for each component.This lacks the 'it just works'ness off the existing auto-docs
react-doc
compatible types, json stringify them and apply them to the__docgenInfo
property on the component. This is deeply unpleasant as working out what types to use has required a lot of deep diving into different codebases, and it's clearly a private API that can't be relied on.Are you able to assist to bring the feature to reality?
yes, I can
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions