Skip to content

Commit

Permalink
Added base path
Browse files Browse the repository at this point in the history
  • Loading branch information
prokawsar committed Nov 26, 2024
1 parent ecef752 commit 628598a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mdsvex.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// import remarkPlugins from './src/plugins/remark/index.js';
import { base } from '$app/paths'
import relativeImages from 'mdsvex-relative-images'
import rehypeExternalLinks from 'rehype-external-links'
import rehypePlugins from './src/plugins/rehype/index.js'
Expand All @@ -22,7 +23,7 @@ export default {
if (node.type === 'element' && node.tagName === 'img') {
// Check if src is a relative path
if (node.properties.src && !node.properties.src.startsWith('http')) {
node.properties.src = node.properties.src.replace(/^\.?\/?/, '/')
node.properties.src = `${base}${node.properties.src}`.replace(/^\.?\/?/, '/')
}
}
return node
Expand Down

0 comments on commit 628598a

Please sign in to comment.