prismicio / prismic-svelte

Svelte components and helpers to fetch and present Prismic content
https://prismic.io/docs/technical-reference/prismicio-svelte
Apache License 2.0
21 stars 6 forks source link

Add inline component documentation using JSDoc (built into Svelte) #1

Closed benaltair closed 1 year ago

benaltair commented 3 years ago

As this library is developed, it would be great to start adding inline documentation which can be used to provide intellisense through that Svelte Language Server.

For example, here's a component with basic documentation:

<script lang="ts">
    import { RichText } from 'prismic-dom';

    import type { RichTextField as RichTextFieldType } from '@prismicio/types';
    import type { TitleField as TitleFieldType } from '@prismicio/types';
        /** A Prismic field. */
    export let field: TitleFieldType | RichTextFieldType;
    export let separator: string = undefined;
</script>
<!--
    @component
    Produces plain text from Prismic Rich Text or Title fields.

-->
{@html RichText.asText(field, separator)}

https://svelte.dev/faq#how-do-i-document-my-components

This shows to the user like this: image

samlfair commented 2 years ago

@benaltair Yep, we're planning to document everything with TSDocs 🙂

benaltair commented 2 years ago

Perfect - after looking through the other Prismic libraries I see this wasn't necessary 😄 Looking forward to seeing things coming together. I'll keep an eye on the docs to see if there are any improvements that would be worth a PR, as they get added

samlfair commented 1 year ago

@benaltair We've been adding components to the package and using TSDoc as we go, so I'm going to close this issue 👍