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

Sfc description tags #1621

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

Leo-Nicolle
Copy link

Hi there, this PR aims to provide a way to handle @description tag in SFC components.

Motivation

In the old vue syntax, vue-docgen-api parses the JSDoc comment on top of the export default as a description for the component:

<script>
/**
 *  My super description
 */
export default {
  name: "MyComponent",

results in

# MyComponent

> My super description

But with the new syntax, there is no way to get this description. So I just added an handler to take care of it:

<script setup lang="ts">
import { ... } from "vue";
/**
 * @description My super description
 */
...

Now results in

# MyComponent

> My super description

Solves this

Copy link

changeset-bot bot commented Nov 3, 2023

⚠️ No Changeset found

Latest commit: db0909e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

what-the-diff bot commented Nov 3, 2023

PR Summary

  • Addition of setupDescriptionHandler in Vue Docgen API Package
    A new module called setupDescriptionHandler has been integrated into the Vue Docgen API package. This module will contribute to enhancing the functionality of the package.

  • Test File for setupDescriptionHandler
    To ensure the proper functioning of the setupDescriptionHandler module, a new testing file has been introduced. This will allow developers to validate and verify the improvements introduced by this new module.

  • Implementation File for setupDescriptionHandler
    The actual working code for the new setupDescriptionHandler module has been added. This file contains all the necessary instructions that make up this new functionality within the Vue Docgen API package.

@Leo-Nicolle Leo-Nicolle mentioned this pull request Nov 3, 2023
4 tasks
Copy link

cypress bot commented Nov 3, 2023

Passing run #544 ↗︎

0 57 0 0 Flakiness 0

Details:

Merge branch 'dev' into sfc-description
Project: vue-styleguidist Commit: 4b6b8653ee
Status: Passed Duration: 03:26 💡
Started: Nov 27, 2023 2:51 PM Ended: Nov 27, 2023 2:54 PM

Review all test suite changes for PR #1621 ↗︎

@elevatebart
Copy link
Member

I would prefer to use the following syntax to keep common matters together:

<script setup lang="ts">
import { ... } from "vue";
/**
 * My super description
 */
defineOptions({
  name: 'ComponentNameInDevTools'
})
...

This way, all features added to the options would be available in setup too.
Also, there would be no need for a handler specific to description.

What do you think?

@Leo-Nicolle
Copy link
Author

Sure ! But I am confused: I used the @description tag because I could not know which comment block is the description, I had to filter out all the other comments. (I am not an expert into AST) How would you know which comments are for something else, and which are for description ?

And then, where to put the logic if not in a specific handler ? In the setupExposeHandler ?

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.

None yet

3 participants