markdown-magic-directory-tree
markdown-magic-directory-tree copied to clipboard
Error when using options
When using options:
DIRTREE: tree({}),
const dir = path.resolve(path.dirname(config.originalPath), options.dir);
^
TypeError: Cannot read properties of undefined (reading 'originalPath')
OK I understood, it seems you have to pass the args down to the plugin:
import path from 'path';
import markdownMagic from 'markdown-magic';
import tree from 'markdown-magic-directory-tree';
import vBadge from 'markdown-magic-version-badge';
const config = {
transforms: {
DIRTREE: (content, options, config) =>
tree(
content,
{ ...options, ignore: [...options.ignore, '.DS_Store'], depth: 1 },
config,
),
VERSIONBADGE: (content, options, config) =>
vBadge(content, options, config),
},
};
const markdownPath = path.join(__dirname, 'README.md');
markdownMagic(markdownPath, config);