-
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
bug: transforms href
of non-anchor elements
#33
Comments
Thanks for this (and the PR). I'm unsure if this should be implemented. Here's my thoughts as to why:
Thoughts? |
Famous last words! lol In all seriousness, understand your points, all valid, hadn't thought about the One of my concerns currently is that the library is pretty broad and there are so many possible scenarios for resolution/evaluation. Without internal Astro information on things (btw, something to consider is taking a dependency on Astro to use some of the APIs & types but that's a different conversation), we have to do a lot of guessing/assuming, hence the options that have been added over time (e.g., Kind of along the lines of #24, #26, #27 & #35, defining a baseline of functionality would be cool as currently we keep asking ourselves, Getting back to this question - I think it would be cool to support any With that said, does it make sense to narrow our surface area for now to reduce risk & simplify and expand if/when someone needs the additional functionality? Lemme know your thoughts - it's your call either way :) |
I think you've convinced me. Also, it says "markdown" in the title of the package, not "all forms of content that may have links." |
lol, wasn't intentionally trying to convince, just sharing my thoughts :) I do think narrowing scope in general for what the library does makes sense given the amount of unknowns during processing. Makes sense to be intentional about adding functionality beyond the basic use case which I believe is intended to be Ironically, I opened #35 which is completely counter to all the thoughts I've shared here lol But it would be an intentional decision to support that scenario I guess lol Look forward to your thoughts on #26 & #27 when you have time. Have a great weekend! |
Per the README, I believe the intended behavior is only to transform links on anchor elements identified in markdown with the following:
Currently, the plugin will transform any element that is a direct child of the root that contains an
href
property if thehref
meets the other required criteria (e.g., relative path, file exists, etc.).Repro: https://github.com/techfg/astro-rehype-relative-markdown-links/tree/fix/only-transform-anchor-elements
Steps to reproduce:
npm install
npm run test
Expected Result:
Test should pass and the
href
on thediv
should not be transformedActual Result:
The
href
is transformedAdditional Information
Difficult to create a live repro of this because any raw
html
(e.g.,<div>foo</div>
in a markdown will become a child element of another element.The text was updated successfully, but these errors were encountered: