Explore auto-generating documentation for composables #691
Labels
category: supporting code
Implementation of the system
help wanted
Open source contributors welcome
P3 - low
Priority: Stretch goal
🌱 Are you new to the codebase? Welcome! Please see the contributing guidelines.
Summary
When the documentation website is built, there's logic that automatically extracts JSDoc comments from a KDS component and then inserts them into the component's documentation page.
For example, in the
KImg
component, thescaleType
prop is documented with:kolibri-design-system/lib/KImg/index.vue
Lines 124 to 132 in 0cbdf57
When the website is built, the comment is automatically inserted into the "Props" section at the bottom of the
KImg
documentation page:The same applies to components' "Events" and "Slots".
However, this only works for components, not for composables. For example, let’s have a look at
useKShow
composable. Even thoughuseKShow
's documentation page contains “Parameters” and “Returns”These are not auto-generated from JSDoc, but written manually here
kolibri-design-system/docs/pages/usekshow.vue
Lines 109 to 117 in 0cbdf57
As we're moving toward using composables more widely in our products and Design System will soon have some new ones, it'd be valuable to have this bottom part of the documentation auto-generated for composables as well.
The goal of this issue is to research if and how we could achieve this and eventually prepare a proof of concept (PoC) implementation. Part of this issue is also exploring how the documentation website should roughly look like if a composable has more publicly exposed entities, such as more functions, some refs, some computed, etc.
Guidance
kolibri-design-system/lib/composables/useKShow/index.js
Lines 26 to 52 in 0cbdf57
vue-docgen-api
is currently utilized for components)The Value Add
Efficiency in creating new and maintaining existing documentation.
Possible Tradeoffs
Potential complexity of the task in light of currently having just few composables (as of July 2024). That’s one of the reasons this issue is scoped rather as exploration at this point.
Comments
If it seems that this idea is not feasible, in the scope of this issue we could at least consider how to make writing of the API section of the composable documentation more efficient, for example in the form of some new documentation utilities or components.
The text was updated successfully, but these errors were encountered: