diff --git a/lib/transformer.js b/lib/transformer.js index f121ce8..6737578 100644 --- a/lib/transformer.js +++ b/lib/transformer.js @@ -125,8 +125,13 @@ export const Transformer = { }, /* Parse file name from path then sanitize it */ parseFileNameFromPath: function (filepath) { - const parsedFileFromPath = filepath.split("/")[filepath.split("/").length - 1] - return parsedFileFromPath.replace(".md", "") + if (typeof filepath ==='string' && filepath.includes("/")) { + const parsedFileFromPath = filepath.split("/")[filepath.split("/").length - 1] + return parsedFileFromPath.replace(".md", "") + } else { + console.log("Failed: CANNOT Parse" + filepath) + return null + } }, /* Pair provided and existing Filenames*/ getInternalLinks: function (aFilePath) { diff --git a/lib/utils.js b/lib/utils.js index f88f30a..5418a8a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -61,7 +61,7 @@ export function toFilePath(slug) { } else { filePath = Node.getMarkdownFolder() + slug .replaceAll('__', '/') - .replaceAll('--', ' ') + .replaceAll('++++', ' ') .replaceAll('ambersand', '&') + ".md"; } @@ -79,7 +79,7 @@ export function toSlug(filePath) { if (Node.isFile(filePath) && filePath.includes(Node.getMarkdownFolder())) { return filePath.replace(Node.getMarkdownFolder(), '') .replaceAll('/', '__') - .replaceAll(' ', '--') + .replaceAll(' ', '++++') .replaceAll('&', 'ambersand') .replace('.md', '') } else {