markdownfmt eats footer links
samsalisbury opened this issue · 2 comments
Given this markdown:
This [paragraph] contains [some links].
[paragraph]: https://en.wikipedia.org/wiki/Paragraph
[some links]: http://example.com
markdownfmt outputs:
This [paragraph] contains [some links].
Would it be possible to not remove those link definitions? Having to put all link URLs in-line tends to make the text unreadable for humans...
Hi @samsalisbury. Thanks for reporting this. This seems like a valid issue.
I don't use definition lists myself, that's why I haven't run into this. But it should definitely not be removing them...
I will look into how invasive and/or easy the fix is, and if it's not too bad, I will resolve this.
Ok, I've looked into this. First of all, I misunderstood, those are not definition lists, they're links, just a different style of writing them. I think they're some sort of reference links (as opposed to inline links).
Although they're not exactly the same kind as what's described at https://daringfireball.net/projects/markdown/syntax#link... Those links have the form like:
This is [an example][id] reference-style link.
Whereas what you posted doesn't have the [id] part. Maybe it's inferred to be the same as link text when missing?
Anyway, the biggest outcome is that I can't reproduce what you originally reported. You said that:
Given this markdown:
This [paragraph] contains [some links]. [paragraph]: https://en.wikipedia.org/wiki/Paragraph [some links]: http://example.commarkdownfmt outputs:
This [paragraph] contains [some links].
However, when I give that markdown to markdownfmt
, it produces the following output:
This [paragraph](https://en.wikipedia.org/wiki/Paragraph) contains [some links](http://example.com).
Which preserves the links, it just inlines them. It's semantically equivalent, although it is a different style of links. It renders into the same HTML.
With that, I have to say this is working as intended. markdownfmt
produces a consistent output style for links.
See related #6 (comment) for more context. But, due to technical limitations of blackfriday
interface, markdownfmt
cannot distinguish between different styles of markdown being used.
Philosophically, I also think it's not ideal to have multiple persistent styles of expressing the same thing... There may be exceptions to this, though. But right now, it's out of scope of markdownfmt
primarily due to implementation difficulties and me giving up on Markdown format ever becoming perfect.