Open ThomasFrans opened 1 year ago
Sorry for the late response.
I think this could be handled better by collecting links separately during parsing and finally checking for links actually used in the text and merging them into the text. (The difficult part would be to properly identify links that span multiple lines of text?)
Since unused links are simply ignored by the viewer, would the current behavior (simply treat the version heading to the next version heading or higher level heading as a single entry) be a practical problem only in a case like "the associated link is not recognized as part of the current entry because it is at the end of the changelog".
Sorry for the late response.
No problem :slightly_smiling_face:
Since unused links are simply ignored by the viewer, would the current behavior (simply treat the version heading to the next version heading or higher level heading as a single entry) be a practical problem only in a case like "the associated link is not recognized as part of the current entry because it is at the end of the changelog".
I'm not sure I fully understand this part. The unused links are indeed ignored by viewers but they show up when using the tool on the command line to get the changes for a specific version if it happens to be the last version in the changelog (see example in the original issue). I don't know exactly how the Markdown specification defines a link or whether it can span multiple lines. If it can, that would be a bit annoying to parse yes.
When parsing the earliest version of a changelog, links to the actual changes aren't taken into account. The Keep a Changelog format lets you put links at the end which allow the user to navigate to the code changes with a single click.
How to Reproduce
For example with the Keep a Changelog changelog on their website, if you run
parse-changelog CHANGELOG.md 0.0.1
, it would return the markdown for version0.0.1
, but also all the links at the bottom of the file, which don't actually belong to the changelog for that version, but are general links for all the separate changelogs.Example
Current Output
Expected Output
PS: Love this tool! Was just about to start something like this myself, but then stumbled upon this.