Make useMarkdownRenderer more generic

This commit is contained in:
Corbin Crutchley
2021-12-10 12:40:02 -08:00
parent cde46fc8a6
commit c658500d86
7 changed files with 29 additions and 21 deletions

View File

@@ -15,10 +15,8 @@ export const isRelativePath = (str: string) => {
return true;
};
export const getFullRelativePostImgPath = (slug: string, srcStr: string) => {
return isRelativePath(srcStr) ? slash(join("/posts", slug, srcStr)) : srcStr;
};
export const getFullRelativeAuthorImgPath = (srcStr: string) => {
return isRelativePath(srcStr) ? slash(join("/unicorns", srcStr)) : srcStr;
export const getFullRelativePath = (...paths: string[]) => {
return isRelativePath(paths[paths.length - 1])
? slash(join(...paths))
: paths[paths.length - 1];
};