Takes a folder path as an imput, and parses the markdown files inside. The parsed files are stored and can be retreived with an API.
# NPM
npm i markdown-folder-api
# Yarn
yarn add markdown-folder-api
let mdFiles = new MarkdownFolder({
path: '/folder/path'
});
mdFiles.on('load', () => {
// Get all files
let allFiles = mdFiles.getAll();
// Get single file
let someFile = mdFile.get('fileName');
// Get single file in a subfolder
let anotherFile = mdFile.get('folderName/fileName');
});
{
"data": "...", // Raw file data
"filePath": "...", // Absolute file path
"attributes": {
... // All attributes from the front matter
},
"body": "...", // Body of the file, without the front matter
"frontmatter": "...", // Raw front matter
"html": "..." // Generated HTML
}
new MarkdownFolder({
// Absolute folder path (String)
path: '/folder/path'
// Switch to enable / disable slugifying the folder / filename (Boolean)
// Default: false
slugify: true
});
This software is currently BETA quality, use at your own risk