From b8e0469e3e11e829105d0efdee71ef700b5db2cc Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 5 Dec 2023 17:02:29 -0500 Subject: [PATCH] Also fix local paths that just start with / --- scripts/src/main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/src/main.ts b/scripts/src/main.ts index a989af5..8c0694e 100644 --- a/scripts/src/main.ts +++ b/scripts/src/main.ts @@ -46,13 +46,16 @@ layout: ../../layouts/ModPage.astro mod: ${JSON.stringify(mod)} --- ${results}` + let repo_root = mod.readme_raw.replace("README.md", ""); // Takes before and after ./ parts of a local path image embed as capture groups let regex = /(!\[.*\]\()\.\/(.*\))/g - - let repo_root = mod.readme_raw.replace("README.md", ""); mod_page = mod_page.replace(regex, "$1" + repo_root + "$2"); + // Also replace local path images that just start with / + let regex2 = /(!\[.*\]\()\.\/(.*\))/g + mod_page = mod_page.replace(regex2, "$1" + repo_root + "$2"); + fs.writeFile(`${srcDir()}/pages/mods/${page_name}.md`, mod_page, 'utf8', (err : Error) => { if (err) { throw new Error(err.message);