Skip to content

Commit

Permalink
fix: allow referencing assets from parent folder (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Jul 16, 2024
1 parent 69588a3 commit 455fa15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/website/src/app/shared/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export function updateAssetsBasePath(markdown: string, baseUrl: string): string
}

// Match all occurrences of unescaped "assets/"
const assetsRegex = new RegExp(`(?<!\\\\|\\\\\.\/)(?:\.\/)?${assetsFolder}`, 'gm');
markdown = markdown.replace(assetsRegex, `${baseUrl}/${assetsFolder}`);
const assetsRegex = new RegExp(`(?<!\\\\|\\\\\.\/)(\.\.\/)?${assetsFolder}`, 'gm');
markdown = markdown.replace(assetsRegex, (_match, root) => `${baseUrl}/${root === '../' ? root : ''}${assetsFolder}`);

// Match all occurrences of escaped "assets/"
const escapedAssetsRegex = new RegExp(`\\\\(?:\.\/)?${assetsFolder}`, 'gm');
Expand Down

0 comments on commit 455fa15

Please sign in to comment.