diff options
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r-- | packages/markdown/remark/src/index.ts | 5 | ||||
-rw-r--r-- | packages/markdown/remark/src/remark-content-rel-image-error.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/src/types.ts | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index 91680f3fd..fdd669280 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -53,7 +53,6 @@ export async function renderMarkdown( remarkRehype = markdownConfigDefaults.remarkRehype, gfm = markdownConfigDefaults.gfm, smartypants = markdownConfigDefaults.smartypants, - isExperimentalContentCollections = false, contentDir, frontmatter: userFrontmatter = {}, } = opts; @@ -91,9 +90,7 @@ export async function renderMarkdown( } // Apply later in case user plugins resolve relative image paths - if (isExperimentalContentCollections) { - parser.use([toRemarkContentRelImageError({ contentDir })]); - } + parser.use([toRemarkContentRelImageError({ contentDir })]); parser.use([ [ diff --git a/packages/markdown/remark/src/remark-content-rel-image-error.ts b/packages/markdown/remark/src/remark-content-rel-image-error.ts index 1a0870c22..3e3664b20 100644 --- a/packages/markdown/remark/src/remark-content-rel-image-error.ts +++ b/packages/markdown/remark/src/remark-content-rel-image-error.ts @@ -10,6 +10,8 @@ import type { VFile } from 'vfile'; export default function toRemarkContentRelImageError({ contentDir }: { contentDir: URL }) { return function remarkContentRelImageError() { return (tree: any, vfile: VFile) => { + if (typeof vfile?.path !== 'string') return; + const isContentFile = pathToFileURL(vfile.path).href.startsWith(contentDir.href); if (!isContentFile) return; diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts index 40b2ac841..ff3060704 100644 --- a/packages/markdown/remark/src/types.ts +++ b/packages/markdown/remark/src/types.ts @@ -59,8 +59,6 @@ export interface MarkdownRenderingOptions extends AstroMarkdownOptions { scopedClassName: string | null; }; /** Used to prevent relative image imports from `src/content/` */ - isExperimentalContentCollections?: boolean; - /** Used to prevent relative image imports from `src/content/` */ contentDir: URL; /** Used for frontmatter injection plugins */ frontmatter?: Record<string, any>; |