-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: create Astro integration wrapper for plugin #45
Comments
This is actually a really interesting option. I've not looked into integrations much, so i'll have to have a look and get back to you on this. I'm a bit strapped for time these days, but let's see where we end up. |
With Astro Starlight and my simple docs setup, the option So you would do something like import type { Options as AstroRehypeOptions } from "astro-rehype-relative-markdown-links";
const linkOptions: AstroRehypeOptions = {
contentPath: "src/content/docs",
};
export default defineConfig({
...
markdown: {
rehypePlugins: [[rehypeAstroRelativeMarkdownLinks, linkOptions]],
},
...
) PS: The types of |
@alexrecuenco - Thanks for the info. Couple of questions:
Thanks! |
Yes. My apologies for confusing you all.
|
Thanks for the info @alexrecuenco, appreciate the follow-up!
Thanks! |
Hm. I an not sure this is the issue to clutter with this. But what I mean is const o: Options = {
|
} Where | is the cursor. It will not show property names if you trigger auto-complete, like it would do usually. |
Agreed this isn't the issue for this, was planning on creating a new issue to track what you found but just want to make sure I'm understanding what you're seeing. Sorry, but unfortunately I'm still not sure what you mean by "trigger auto-complete" - when I start typing a property name, intellisense detects and displays the corresponding properties in Options - possibly I'm misunderstanding what you mean by "auto-complete". Would you mind creating a new issue with the two problems you have found including detailed steps on how to reproduce, specifically around how you "initiate" and what you mean by "auto-complete"? Once created, I'll review and work on a fix. Thanks! |
@alexrecuenco - Thanks again for mentioning the hover & intellisense issues! I've finally been able to re-create both of them and created #72 to track. |
@techfg thinking about this one out loud.
It would definitely be interesting to give a shot to explore this more! |
Hmm, so had a look at the integrations API, and it does seem like we'd not have access to the astro version / astro meta data. This would make it a bit more difficult to support all versions of astro "automagically"... |
Thanks for the thinking here. Yeah, I think we'd follow the I poked around the Integration API and unfortunately, I'm not seeing a way to obtain collection information during build. I'm still trying to figure out a way though. If we're able to obtain collection information, we may be able to simplify approach configuration wise for #74. If we can't, then there is still value in being an Astro integration (e.g., to get Astro config trailingSlash, srcDir, etc. config values) but not much beyond that unfortunately. All that said, I do think making this an integration instead of a straight rehype-plugin makes sense although there's not a ton of value to do so. |
Currently, this library is Astro specific but it doesn't take a dependency on Astro in any way. Some of the logic is very Astro specific but in actuality there is very little of it. Without too much of a challenge, the plugin could be made generic to handle
md/mdx
links in general, rather than just Astro.That said, it's not the stated mission of the plugin to transform links for anything but Astro. Along that line, I think it makes sense to create a pure Astro integration. This would allow for a few things:
basePath
, etc.As an example, checkout starlight-links-validator. This plugin validates links contained within markdown. I haven't fully explored it and/or the possibilities of what a true integration could open doors for but there is likely something there to be explored/considered.
Look forward to hearing thoughts!
Edit: The above would come with the downside of having to decide on which versions of Astro to support and the additional maintenance cost of keeping up with Astro releases, backwards compat, etc. This requirement kind of already exists but it's rather loose since its just directory structures that are relied on from Astro and not APIs, types and/or any other internals. Short story, there are pros/cons but its possible being a full fledged integration would yield benefits and could be worth at least a POC to explore further.
The text was updated successfully, but these errors were encountered: