Skip to content

Commit

Permalink
Merge pull request #26 from DREDGE-Mods/dev
Browse files Browse the repository at this point in the history
Also fix local paths that just start with /
  • Loading branch information
xen-42 authored Dec 5, 2023
2 parents b047fcc + b8e0469 commit c7a53e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c7a53e8

Please sign in to comment.