histoire-dev / histoire

⚡ Fast and beautiful interactive component playgrounds, powered by Vite
https://histoire.dev
MIT License
3.21k stars 192 forks source link

Automatic story generation #198

Open ennioVisco opened 2 years ago

ennioVisco commented 2 years ago

Clear and concise description of the problem

First of all, thumbs up for this project, I stumbled on it a few hours ago, and I'm totally in love with the concept, and with what you are doing.

I want to challenge the developers with one idea: Histoire could be directly incorporated into the development flow, where stories for basic components could be generated automatically by exploiting vue's SFC syntax.

Suggested solution

Example of a well-documented component for a button:

<!-- components/buttons/MyButton.vue -->
<script>
// Javascript from https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-api
export default {
  props: {
    /**
     * Color of the button.
     */
    color: {
      type: String,
      default: '#FCC'
    },
    /**
     * initial value to be passed but undocumented
     * @ignore
     */
    initialvalue: {
      type: Number,
      default: 0
    },
    /**
     * The size of the button allows only some values
     * @values small, medium, large
     */
    size: {
      default: 'normal'
    }
  }
}
</script>

<template>
    <button :width="size" ...>
        <slot /> 
    </button>
</template>

<docs lang="md">
# My button documentation
...
</docs>

It looks to me that already many information for a story are present, where the title of the story, the path etc. can all be derived from the present information. What do you think?

Alternative

No response

Additional context

No response

Validations

a474516631 commented 1 year ago

Yep, I think that's a great idea too. In the process of using histoire, I also wrote a similar cli to do similar things. I think it greatly improves the efficiency of my writing documents

Akryum commented 1 year ago

related to #126 #41