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

JSON genType for CLI #2

Open
sagalbot opened this issue Apr 17, 2019 · 3 comments
Open

JSON genType for CLI #2

sagalbot opened this issue Apr 17, 2019 · 3 comments

Comments

@sagalbot
Copy link

Documenting props and events in my open source component has always been a time suck and I'm really excited at the prospect of this project, thanks for the great work so far.

I already have an existing VuePress site with extensive documentation, so the existing outputs of docute and markdown present challenges.

Have you considered a JSON output? This would allow a lot of flexibility for those that have to integrate with existing documentation site. If I had a JSON file, I could create a component that iterates the contents and have full control over the display of the information.

@HcySunYang
Copy link
Member

Can @vuese/parser meet your needs? Maybe @vuese/loader can do better, but it's still under planning.

@sagalbot
Copy link
Author

sagalbot commented Apr 18, 2019

I believe it could, but I wasn't sure how to get it up and running. I wasn't sure what to do with the snippet:

// Import parser function
import { parser } from '@vuese/parser'

// Read vue file content
const source = fs.readFileSync('path-to-your-component.vue', 'utf-8')

// Parse and get the result using the parser function
try {
  const parserRes = parser(source)
} catch(e) {
  console.error(e)
}

Because fs is being called, I figured this must need to be executed by now, sop I threw this into generate.js and then run node generate.js, but I don't think that's the suggested approach.

@HcySunYang
Copy link
Member

HcySunYang commented Apr 18, 2019

I just realized that you are using VuePress, and here is a community plugin: https://buptsteve.github.io/markdown-it-vuese/example/. It can be used for VuePress, what do you think?

Edit: https://buptsteve.github.io/markdown-it-vuese/example/vuepress.html

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

No branches or pull requests

2 participants