-
Notifications
You must be signed in to change notification settings - Fork 46
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
convert inline links to references? #420
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Super interested by this as well. Would be happy to try and send a PR if a maintainer can provide some initial guidance 😄 |
Would love to see this - but it does mean this tooling needs to make very opinionated decisions about how to make the translation from inline -> reference links work
|
Good questions.
We just need updates from maintainers 🙂 |
Fun fact: mdformat was inline links only originally #32 This shouldn't be hard to do at all. Mdformat already places references at the end of the document, orders alphabetically, canonicalizes labels to lower case, removes duplicate refs, removes unused refs etc. so much of what has been discussed here is already implemented. It's just that we have to come up with the link label completely on our own.
This isn't a good enough spec. The link text can be empty string, link label cannot. Link text is unlimited in size, link label is limited to 999 characters. There's probably more pitfalls. An alternative is to number the labels, 1, 2, 3, 4, ... . There are certainly documents that have more than 1000 links though. So I think in extreme cases we probably have to resort to some kind of hash values. So I'm not sure about this at all. If anyone wants this to happen, please come up with the perfect spec and we can consider. 😄 Maybe even more importantly, I have a feeling there's more users that don't want this feature than those who do. I may be wrong. If there's anyone who has a use case where this feature would really suck, please write in this thread! 😄 In any case, the plugin API remains to be there for people who want to extend mdformat. |
Thanks for the update @hukkin, and for pointing out the shortcomings of the proposal 🙂 I might try to write a plugin for that! That would be a good first exercise to get to know mdformat's internals 😄 |
Context
I'm an apologetic reference link fan. For me, they make the source document easier to read, and I often send markdown documents by email (for various reasons) where it is particularly important to get those pesky links out of the way.
Proposal
It would be nice if mdformat could (optionally? in a plugin?) completely convert all inline links to references in a document. It's not a simple task, as references might clash with each other, so there needs to be some tracking for that...
I understand if that can't be part of mdformat per se, but I figured i would use this space to open up discussion about this, perhaps someone else has already found and fixed that problem themselves?
Thanks!
Tasks and updates
No response
The text was updated successfully, but these errors were encountered: