https://github.com/vinicius73/vuepress-plugin-merge-pages
VuePress Plugin: Merge markdown files in a single markdown
https://github.com/vinicius73/vuepress-plugin-merge-pages
markdown vue vuejs vuepress vuepress-plugin
Last synced: 9 months ago
JSON representation
VuePress Plugin: Merge markdown files in a single markdown
- Host: GitHub
- URL: https://github.com/vinicius73/vuepress-plugin-merge-pages
- Owner: vinicius73
- License: mit
- Created: 2019-10-19T04:40:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T09:59:02.000Z (about 3 years ago)
- Last Synced: 2024-10-11T21:22:10.869Z (about 1 year ago)
- Topics: markdown, vue, vuejs, vuepress, vuepress-plugin
- Language: JavaScript
- Homepage:
- Size: 1.72 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vuepress-plugin-merge-pages
> VuePress Plugin: Merge Markdown files in a single Markdown






## Install
```bash
yarn add vuepress-plugin-merge-pages -D
npm install vuepress-plugin-merge-pages --save-dev
```
## Usage
```js
module.exports = {
plugins: [
[
'vuepress-plugin-merge-pages',
{
bundles: [{
path: '/printable',
name: 'print-all-content-page', // optional
filter: (pages) => { // optional
return pages.filter(({ path }) => path.includes('/printable-page/'))
},
mergePages: pages => { // optional
const pageBreak = '
\n\n'
const initialValue = `# My Printable Page\n\n[[TOC]]\n${pageBreak}`
return pages
.reduce((acc, current) => {
return `${acc}${current.content}\n\n${pageBreak}`
}, initialValue)
}
}]
}
]
]
}
```
### Options
#### bundles
- Type: `Array`
- Required: `true`
List of target merge files.
#### bundles[].path
- Type: `String`
- Required: `false`
Page route path, url of target page.
#### bundles[].name
- Type: `String`
- Required: `false`
Name of generated file.
#### bundles[].filter
- Type: `Function => Page[]`
- Required: `false`
Filter pages of bundle. Receive `pages` and return new list of pages
See above example for mor details
##### Page object
```js
// page object
{
content: String,
path: String,
}
```
#### bundles[].mergePages
- Type: `Function => String`
- Required: `false`
Custom content merge. Allow interaction with pages to inject custom contents.
See above example for mor details