vuepress-plugin-merge-pages
v1.4.0
Published
VuePress Plugin: Merge Markdown files in a single Markdown
Downloads
30
Maintainers
Readme
vuepress-plugin-merge-pages
VuePress Plugin: Merge Markdown files in a single Markdown
Install
yarn add vuepress-plugin-merge-pages -D
npm install vuepress-plugin-merge-pages --save-dev
Usage
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 = '<hr class="page-break" />\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
// 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