Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vuepress/vuepress-plugin-schema2md
A VuePress plugin to help you generate pages via JSON Schema (HMR โ
)
https://github.com/vuepress/vuepress-plugin-schema2md
Last synced: about 1 month ago
JSON representation
A VuePress plugin to help you generate pages via JSON Schema (HMR โ )
- Host: GitHub
- URL: https://github.com/vuepress/vuepress-plugin-schema2md
- Owner: vuepress
- License: mit
- Archived: true
- Created: 2020-03-07T08:28:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T06:23:32.000Z (over 4 years ago)
- Last Synced: 2024-08-03T09:07:34.326Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 670 KB
- Stars: 20
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - vuepress-plugin-schema2md
README
# vuepress-plugin-schema2md
[![NPM version](https://img.shields.io/npm/v/vuepress-plugin-schema2md.svg?style=flat)](https://npmjs.com/package/vuepress-plugin-schema2md) [![NPM downloads](https://img.shields.io/npm/dm/vuepress-plugin-schema2md.svg?style=flat)](https://npmjs.com/package/vuepress-plugin-schema2md) ![Node.js CI](https://github.com/rich-lab/vuepress-plugin-schema2md/workflows/Node.js%20CI/badge.svg)
## Feature
- ๐ Generate dynamic VuePress pages from JSON Schemas.
- โค๏ธ HMR Support!
- ๐ Support extra markdown file to be merged into final content.## Example
![](./.media/demo.gif)
Tip. you can executenpm run docs:dev
on thie repo to check out this example.## Install
```bash
yarn add vuepress-plugin-schema2md -D
# OR npm install vuepress-plugin-schema2md -D
```## Usage
```js
// .vuepress/config.js
module.exports = {
plugins: [
[
'schema2md', {
// Options
}
]
]
}
```## Options
### pages
- Type: `Record`
- Description: describe the generated pages.e.g.
```js
// .vuepress/config.js
module.exports = {
plugins: ['schema2md', {
pages: {
'/config/': {
schemaPath: '/path/to/your/schema.json'
}
}
}]
}
```Then you will get a dynamic page with route `/config/`, whose content is generated by [schema2md](https://github.com/rich-lab/schema2md) from `'/path/to/your/schema.json'`,
For typings of interface `ITransformOptions`, plead head [schema2md](https://github.com/rich-lab/schema2md).
### cwd
- Type: `string`
- Description: Current working directory, used to calcaulate absolute path for "schemaPath" and "outputPath" with relative path, defaults to `process.cwd()`.### locale
- Type: `string`
- Description: Global locale.### write
- Type: `boolean`
- Description: whether to generate the markdown content to disk.If you want to check out the generated markdown, you could do like this:
```diff
// .vuepress/config.js
module.exports = {
plugins: ['schema2md', {
+ write: true,
pages: {
'/config/': {
schemaPath: '/path/to/your/schema.json'
+ outputPath: 'docs/config/README.md', // You shouldn't commit this file.
}
}
}]
}
```## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## Author
**vuepress-plugin-schema2md** ยฉ [ULIVZ](https://github.com/ulivz), Released under the [MIT](./LICENSE) License.
> [github.com/ulivz](https://github.com/ulivz) ยท GitHub [@ULIVZ](https://github.com/ulivz) ยท Twitter [@_ulivz](https://twitter.com/_ulivz)