Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support expressions in links #79

Open
mierak opened this issue Dec 18, 2024 · 3 comments
Open

Support expressions in links #79

mierak opened this issue Dec 18, 2024 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@mierak
Copy link

mierak commented Dec 18, 2024

Is your feature request related to a problem?

Hi! First of all, thank you for the great plugin. It works great for me except in one case:

Currently links get validated (at least in mdx) when they are in their simplest form, for example:

<a href="/some/page">test</a>

however this does not work and the links get ignored and marked as being valid even when they are not:

export const base = "/someBasePath";

<a href={base + "/some/page"}>test</a>

Describe the solution you'd like

It would be great if the plugin is is able to resolve the expression inside the href to its real value and validate it.

Describe alternatives you've considered

No response

Additional Context

No response

@mierak mierak changed the title Support for experssions in links Support expressions in links Dec 19, 2024
@HiDeoo
Copy link
Owner

HiDeoo commented Dec 21, 2024

Thanks for the kind words! Really glad you like it.

With the current architecture, I don't think it's possible to support this use case. A solution could be to move the validation at a later stage altho I'm planning to add more features to the plugin that would prevent this from happening. I'll still investigate this and see if I can come up with a solution.

One question: is the example you provided the only case you're having trouble with, e.g. adding a base to a link? If so, I think this process could be moved to a remark plugin running before the links validator which would allow you to add the base to the links before they're validated.

@HiDeoo HiDeoo added enhancement New feature or request question Further information is requested labels Dec 21, 2024
@mierak
Copy link
Author

mierak commented Dec 21, 2024

Thanks for the response!

I basically wanted to create a poor man's versioning system, where I would keep two versions of the page, the development and latest release ones, with a common index page. Where creating a new version would involve deleting the old release, copying the current dev version to release version and changing the base in its config file.

So my site would have two bases for two different sections of the web. I have it working in a branch here mierak/rmpc#182 and the base is kept here

@HiDeoo
Copy link
Owner

HiDeoo commented Dec 21, 2024

I see, thanks for the follow-up 🙌 I'll investigate and see if somehow it's a use-case the plugin could support 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants