heading-doc-parser
A simple parser for doc generation.
feature
- Lightweight - less than 2kb before gzip
- Type Support - friendly with typescript
Install
npm install heading-doc-parser
Usage
simple usage
import parseDoc from 'heading-doc-parser'
const code = `
/**
* description
* @title - 1
* @desc
* hello
* world
*/
export function Demo() {
return <button>demo</button>
}
`
console.log(parseDoc(code))
Type Support
import parseDoc from 'heading-doc-parser'
const code = `
/**
* description
* @title - 1
* @desc
* hello
* world
*/
export function Demo() {
return <button>demo</button>
}
`
type Key = 'title' | 'desc'
console.log(parseDoc<Key>(code))