Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yucccc/vitepress-plugin-props2table
📃 Parsing interface Show as a table.
https://github.com/yucccc/vitepress-plugin-props2table
interface interface-to-table markdown parse parse-interface parse-props plugin props-to-table
Last synced: 2 days ago
JSON representation
📃 Parsing interface Show as a table.
- Host: GitHub
- URL: https://github.com/yucccc/vitepress-plugin-props2table
- Owner: yucccc
- License: mit
- Created: 2022-09-26T03:05:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-08T01:13:16.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T16:45:37.914Z (about 2 months ago)
- Topics: interface, interface-to-table, markdown, parse, parse-interface, parse-props, plugin, props-to-table
- Language: TypeScript
- Homepage: http://yucccc.com/vitepress-plugin-props2table/
- Size: 1.69 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vitepress-plugin-props2table
Parsing interface Show as a table.
## why?
Writing component documents makes the work cumbersome.
Using this plug-in, you can directly import parameter files to parse the table format you want.中文
编写组件文档让工作变得繁琐,使用该插件可以直接导入参数文件,从而解析为你想要的表格格式## install
```bash
pnpm i vitepress-plugin-props2table
```## usage
1、add plugin in `vite.config.js`
```typescript
import { props2table } from 'vitepress-plugin-props2table'export default defineConfig({
plugins: [
props2table(),
],
})
```2、add command in markdown
```markdown
@props2table(/path.ts)
```3、and you will see a table
Output table demo
参数说明类型是否必填可选值默认值a描述astringtrue默认值是1b描述b 是一个枚举值a | b | ctrue默认值是ac描述c是一个外部引用的类型Props2truee描述e 是一个数组string[]truefRecord<string, string>true## Get Parse Interface
> If you don't want to render it as a table and want to get the parsing results
> you can directly use the `parseInterface` method.```typescript
import { parseInterface } from 'vitepress-plugin-props2table'
parseInterface('you code') // return JSON => ParseInterfaceTypes
```[ParseInterfaceTypes](http://yucccc.com/vitepress-plugin-props2table/#parseinterfacetypes)
## doc
http://yucccc.com/vitepress-plugin-props2table/