If you rewrite a paragraph so that the order that links appear is broken, then you need to figure out how to do that reordering on the links. I don't find this more maintainable.
I think a better way is to specify the number a link refers to but reorder it if it's out of order. So maybe you have 1,2,3 then after an edit it's 1,2,5,4,3 then after publishing it becomes 1,2,3,4,5 while still prserving the order of links (so only changing numbers)
I have done this type of thing for years. It is similar
to the 'Lazy Link' work by Brett Terpstra[*] and Tyler
Butler[1]. I have tweaked my own python version of this
script over the years. My script recognizes Numbered and
Lazy links, maintains the order of Number Links while
adding in the Lazy links.
Importantly, I DO NOT LEAVE MY TEXT IN LAZY FORMAT, but
run my script to convert everything to numbered and SAVE
it. In fact, I have VS Code set to automatically run
every time I save a markdown document. This addresses
[chalst's point][*] about the maintainability of link
order.
While I do not use footnotes in Markdown, Lazy links can
[extended to footnotes][2]
I suggest to jgalvez reference the term "Lazy Links" in
your documents for search-ability of this feature.
[*]: http://brettterpstra.com/2013/10/19/lazy-markdown-reference-links/
[1]: https://www.tylerbutler.com/2014/05/markdown-lazy-links-in-python/
[*]: https://news.ycombinator.com/item?id=17547765
[2]: http://brettterpstra.com/2013/10/30/lazy-markdown-footnotes/
I have done this type of thing for years. It is similar
to the 'Lazy Link' work by Brett Terpstra[1] and Tyler
Butler[2]. I have tweaked my own python version of this
script over the years. My script recognizes Numbered and
Lazy links, maintains the order of Number Links while
adding in the Lazy links.
Importantly, I DO NOT LEAVE MY TEXT IN LAZY FORMAT, but
run my script to convert everything to numbered and SAVE
it. In fact, I have VS Code set to automatically run
every time I save a markdown document. This addresses
[chalst's point][3] about the maintainability of link
order.
While I do not use footnotes in Markdown, Lazy links can
[extended to footnotes][4]
I suggest to jgalvez reference the term "Lazy Links" in
your documents for search-ability of this feature.
[1]: http://brettterpstra.com/2013/10/19/lazy-markdown-reference-links/
[2]: https://www.tylerbutler.com/2014/05/markdown-lazy-links-in-python/
[3]: https://news.ycombinator.com/item?id=17547765
[4]: http://brettterpstra.com/2013/10/30/lazy-markdown-footnotes/
6 comments
[ 2.9 ms ] story [ 21.8 ms ] threadYou rarely edit a paragraph with links?
I think a better way is to specify the number a link refers to but reorder it if it's out of order. So maybe you have 1,2,3 then after an edit it's 1,2,5,4,3 then after publishing it becomes 1,2,3,4,5 while still prserving the order of links (so only changing numbers)