@@ -15,7 +15,7 @@ export function getMarkdownCodeForImages(
1515 const imageSources = {};
1616 ${ localImagePaths
1717 . map ( ( entry ) => {
18- const rawUrl = JSON . stringify ( entry . raw ) ;
18+ const rawUrl = JSON . stringify ( entry . raw ) . replace ( / ' / g , ''' ) ;
1919 return `{
2020 const regex = new RegExp('__ASTRO_IMAGE_="([^"]*' + ${ rawUrl . replace (
2121 / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g,
@@ -25,7 +25,7 @@ export function getMarkdownCodeForImages(
2525 let occurrenceCounter = 0;
2626 while ((match = regex.exec(html)) !== null) {
2727 const matchKey = ${ rawUrl } + '_' + occurrenceCounter;
28- const imageProps = JSON.parse(match[1].replace(/"/g, '"'));
28+ const imageProps = JSON.parse(match[1].replace(/"/g, '"').replace(/'/g, "'") );
2929 const { src, ...props } = imageProps;
3030 imageSources[matchKey] = await getImage({src: Astro__${ entry . safeName } , ...props});
3131 occurrenceCounter++;
@@ -35,7 +35,7 @@ export function getMarkdownCodeForImages(
3535 . join ( '\n' ) }
3636 ${ remoteImagePaths
3737 . map ( ( raw ) => {
38- const rawUrl = JSON . stringify ( raw ) ;
38+ const rawUrl = JSON . stringify ( raw ) . replace ( / ' / g , ''' ) ;
3939 return `{
4040 const regex = new RegExp('__ASTRO_IMAGE_="([^"]*' + ${ rawUrl . replace (
4141 / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g,
@@ -45,7 +45,7 @@ export function getMarkdownCodeForImages(
4545 let occurrenceCounter = 0;
4646 while ((match = regex.exec(html)) !== null) {
4747 const matchKey = ${ rawUrl } + '_' + occurrenceCounter;
48- const props = JSON.parse(match[1].replace(/"/g, '"'));
48+ const props = JSON.parse(match[1].replace(/"/g, '"').replace(/'/g, "'") );
4949 imageSources[matchKey] = await getImage(props);
5050 occurrenceCounter++;
5151 }
0 commit comments