Skip to content

Remark plugin file parameter is missing data #14205

@noatpad

Description

@noatpad

Astro Info

Astro                    v5.12.9
Node                     v24.5.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Hello hello. I am currently trying to make a remark plugin that will target only specific Markdown files in a specified directory and do some text replacement. However, it seems like the file parameter within a plugin does not contain the complete data definition for the file, such as the filename, its directory, and so on. I assume that the remark plugin is supposed to have the following typing in its function, which states that the file parameter is supposed to be a VFile. But as the mini reproduction example, it seems to only return a few of those fields, those being cwd, data, history, messages, and values.

Furthermore, it seems like the history array is also empty if the markdown content is rendered via a custom loader's renderMarkdown() function (which was also part of my use case).

I've looked through the Issues here, and I noticed that a similar problem has happened in the past in #3264, stating that file.path was undefined and was fixed.

What's the expected result?

The file parameter in a remark plugin should return the full VFile data, mainly its filename and path.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-8eyj3f4b?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions