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

Expose svelte2tsx component documentation #1346

Closed
wants to merge 1 commit into from

Conversation

Tymek
Copy link

@Tymek Tymek commented Jan 27, 2022

No currently available tool is able to generate complete component documentation from svelte file. There are many attempts listed here sveltejs/kit#1979 (comment). With this change it will be possible to access documentation of component and use svelte2tsx as a docgen tool.

@Tymek Tymek force-pushed the expose-parsed-docs branch 4 times, most recently from ae2b13f to 7bb4385 Compare January 27, 2022 16:40
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain what's the benefit of exposing additional properties here, and what format would be most fitting?

componentDocumentation: string;
slots: Map<string, Map<string, string>>;
generics: {
definitions: string[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types say these are strings, but that's not true from the implementation (besides it's definition in the implementation). In the implementation it's just one string fitting the use case which is producing correct code, not something for use later.

@Tymek
Copy link
Author

Tymek commented Jan 31, 2022

Most fitting format will probably be similar if not identical to what sveld is using. ParsedComponent interface in sveld/src/ComponentParser.ts#L98-L106

With this change using other parsers like sveld will not be necessary to output slots, generics etc.

I get it if this use case is better left for another package.

@Tymek Tymek force-pushed the expose-parsed-docs branch from 7bb4385 to 4ad7631 Compare January 31, 2022 09:22
@mrtnbroder
Copy link

@Tymek I think it would also be great to add examples on how to use it. Not neccessarily needed in this PR, but for the general public it still looks quiet abstract.

@Tymek Tymek closed this Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants