fix markdown rendering

This commit is contained in:
Jeremy Kauffman 2018-10-16 10:12:15 -04:00
parent 7e90e092d6
commit fc2e34c2a5

View file

@ -62,8 +62,7 @@ function partialFinder(markdownBody) {
const regexToFindPartials = /<\w+ ?\/>/g; const regexToFindPartials = /<\w+ ?\/>/g;
const partials = markdownBody.match(regexToFindPartials); const partials = markdownBody.match(regexToFindPartials);
if (!partials) return markdownBody; if (partials) {
for (const partial of partials) { for (const partial of partials) {
const filename = decamelize(partial, "-").replace("<", "") const filename = decamelize(partial, "-").replace("<", "")
.replace("/>", "") .replace("/>", "")
@ -80,6 +79,7 @@ function partialFinder(markdownBody) {
else markdownBody = markdownBody.replace(partial, `</div>${partialFunction.default()}<div class="page__markup">`); else markdownBody = markdownBody.replace(partial, `</div>${partialFunction.default()}<div class="page__markup">`);
} }
} }
}
return ("<div class=\"page__markup\">" + markdownBody + "</div>").replace(/<div class="page__markup">\s*<\/div>/, ""); return ("<div class=\"page__markup\">" + markdownBody + "</div>").replace(/<div class="page__markup">\s*<\/div>/, "");
} }