VuePress Plugin: Merge Markdown files in a single Markdown
yarn add vuepress-plugin-merge-pages -D
npm install vuepress-plugin-merge-pages --save-dev
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)
}
}]
}
]
]
}
- Type:
Array
- Required:
true
List of target merge files.
- Type:
String
- Required:
false
Page route path, url of target page.
- Type:
String
- Required:
false
Name of generated file.
- 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
{
content: String,
path: String,
}
- Type:
Function => String
- Required:
false
Custom content merge. Allow interaction with pages to inject custom contents. See above example for mor details