vue-docgen-cli
Version:
Generate documentation markdown files from VueJs components using the vue-docgen-api.
17 lines (15 loc) • 448 B
text/typescript
import type { Tag, ParamTag } from "vue-docgen-api"
function isTag(v: Tag | ParamTag): v is Tag {
return !!(v as any).content
}
export const renderTags = (tags?: { [tag: string]: (Tag | ParamTag)[] }): string => {
if (!tags) {
return ''
}
return Object.entries(tags)
.map(([tag, values]) => {
if(tag === 'type') return ''
return values.map(v => `\n\`@${tag}\` ${isTag(v) ? v.content : v.description}`).join('')
})
.join('')
}