Vue-styleguidist: @requires alternative to mark a dependency without removing it from the main docs tree

Created on 26 Aug 2020  路  3Comments  路  Source: vue-styleguidist/vue-styleguidist

So @requires marks another component as a dependency but removes it from the main docs.
Is it possible to do so without removing it?

In the current usecase I have a Modal component which is used inside another component.
I would love to refer in the documents to the Modal component without removing it as a component on it's own.

Something like
@uses './Modal'

Would be cool if it would work with interfaces also.

enhancement intend to implement

All 3 comments

Hello @snakemastr,

That is an interesting idea.
What would this tag look like in the documentation?
A link to the other components documentation?

Where would you expect this link to be? Before or after the component props and doc?

A link to the other components documentation?

Yes I think the link to the component itself would be logical as it could refer to a component in a different section or on a different page.

What would this tag look like in the documentation?
Where would you expect this link to be? Before or after the component props and doc?

I would place it in the same position in the hierarchy as "requires" so dependencies are grouped. I made an example for the combination with requires.
Perhaps with lesser space inbetween as they could be presented together
Knipsel_1

A more compact view
Knipsel_2

I remember @davatron5000 talking about this kind of feature being useful in Austin TX.
We might even be able to go one step further and automatically extract which components are used from the code.

The @use tag is a rendering of a link.
One non-obvious part of the making of this feature is figuring out the content of the href.
Each component can have url inside of a section so resolving the path in the sections means probably having all
component filePath => component docs urlPath map available at render time.
Since we render the side bar for all the sections, I guess we could find a way to store this structure.
Then it would be a matter of waiting for this structure to be ready to pick in the map for the url.

I will create another issue for the docgen extraction.

Was this page helpful?
0 / 5 - 0 ratings