Skip to content
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

RDoc::Parser::ChangeLog doesn't handle keep-a-changelog style CHANGELOG correctly #1133

Open
okuramasafumi opened this issue Jul 6, 2024 · 0 comments

Comments

@okuramasafumi
Copy link
Contributor

Background

This is not a "bug", because it says

This parser is meant to parse the MRI ChangeLog, but can be used to parse any # {GNU style ChangeLog}[http://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html].

However, when we run rdoc command, it automatically parses CHANGELOG.md file and outputs some wrong results. This is done by default so it's not a desired behavior.

Problem

When parsing a markdown snippet like below:

## [3.0.0] 2023-10-11

### IMPORTANT

**This release contains an important bug fix that can cause data corruption.**
**If you're using Ruby 3, it's highly recommended to upgrade to [v3.0.0](https://rubygems.org/gems/alba/versions/3.0.0)**
**If you're using Ruby 2, please upgrade to [v2.4.2](https://rubygems.org/gems/alba/versions/2.4.2) that contains bug fix only as soon as possible.**

it should create a link for v3.0.0 since it's a valid markdown syntax (GitHub renders it as a link, for example, see https://github.com/okuramasafumi/alba/blob/main/CHANGELOG.md#300-2023-10-11).

However, the resulted HTML is:

<h2 id="label-5B3.0.0-5D+2023-10-11">[3.0.0] 2023-10-11<span><a href="#label-5B3.0.0-5D+2023-10-11">&para;</a> <a href="#top">&uarr;</a></span></h2>

<h3 id="label-IMPORTANT">IMPORTANT<span><a href="#label-IMPORTANT">&para;</a> <a href="#top">&uarr;</a></span></h3>

<p><strong>This release contains an important bug fix that can cause data corruption.</strong> <strong>If you’re using Ruby 3, it’s highly recommended to upgrade to {v3.0.0}[https://rubygems.org/gems/alba/versions/3.0.0]</strong> <strong>If you’re using Ruby 2, please upgrade to {v2.4.2}[https://rubygems.org/gems/alba/versions/2.4.2] that contains bug fix only as soon as possible.</strong></p>

The link parts are not rendered correctly.

Solution

The comment in this parser says it's for GNU style changelog only, but I believe most projects use keep a changelog style. They don't look compatible.
So we have two ways. One is to improve the current changelog parser so that it can parse both styles. Another is to create another parser for keep-a-changelog style specific.

We can also discuss if including changelog into a resulted documents is desired or not. YARD doesn't include it, so maybe nobody wants it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant