Skip to content
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

Ability to add docs #49

Closed
andreasvirkus opened this issue Apr 7, 2023 · 4 comments · Fixed by #53 or #46
Closed

Ability to add docs #49

andreasvirkus opened this issue Apr 7, 2023 · 4 comments · Fixed by #53 or #46
Labels
status: waiting for info type: enhancement Improving upon an existing feature

Comments

@andreasvirkus
Copy link

It'd be great if we could easily add documentation in our SFC stories, akin to the MDX experience. Maybe a <Docs> component could help us more easily extract this?

@tobiasdiez
Copy link
Owner

Can you explain a bit more what you want to do? Under the hood, the addon translates vue story files into the classical Component Story Format. But I don't think that CSF provides a way to specify documentation.

@tobiasdiez tobiasdiez added type: enhancement Improving upon an existing feature status: waiting for info labels Apr 7, 2023
@andreasvirkus
Copy link
Author

Even adding the description would be a nice start (available in story params). But with MDX you can document various use-cases as freeform text, sprinkling in the component between text blocks. That'd be ideal for us.

An example use-case would be describing the UX rules behind validation errors, where we'd want to show different cases (e.g. the whole field component in an error state, with the validation error being displayed vs just the input field's border indicating a validation error) and explain when to display each.

@tobiasdiez
Copy link
Owner

tobiasdiez commented Apr 10, 2023

And how do you want to declare the documentation part? Do you just want to have a <docs lang=mdx>...</docs> block where you can put whatever you would normally put in the mdx file? This is possible (see https://github.com/johnsoncodehk/vite-plugin-vue-component-preview for a similar idea), but requires quite a bit of setup to get right (in particular to get linter + ide support, see e.g. vuejs/language-tools#1687).

@tobiasdiez
Copy link
Owner

Support for a docs custom block is now added (see readme for details). Please give it a try 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for info type: enhancement Improving upon an existing feature
Projects
None yet
2 participants