-
Notifications
You must be signed in to change notification settings - Fork 33
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
Inconsistent title and body across platforms #27
Comments
Thanks for reporting! Any help in investigating is welcome. |
@adamzerella if you can include the source file that's producing this output that would help a lot too -- we could construct a failing test and repair it from there. |
If it's based on this: https://github.com/adamzerella/changelog-skimmer/blob/master/index.spec.js I believe part of the issue is that the changelog you're feeding the parser isn't entirely valid -- the spec used for the parser expects a document title, e.g.
so it seems like it's interpreting the first line as the title. The fact that the (incorrect) result is different between linux and windows is concerning. |
@ungoldman I can't reference a codesandbox or anything because this package requires a file path. In general though, the following code should yield the result I'm describing: CHANGELOG.md## 15.5.1
### SUB-HEADING (Category)
- Item 1
- Item 2
### SUB-HEADING (Category)
- Item 3
- Item 4
## 15.5.0
### SUB-HEADING (Category)
- Item 6
- Item 2 index.jsconst ChangelogParser = require("changelog-parser");
const Path = require( 'path' );
(async () => {
let filePath = Path.join( __dirname, 'CHANGELOG.md');
let result = await ChangelogParser( filePath );
console.log( result );
})(); |
Not sure if you saw my comment above -- a title element is currently required in order to parse the document. For your example, you'd need to add something like Please try that out and let me know if you're still seeing issues. |
Adding a title element to the Using the same CHANGELOG.md
Output:
This is also doesn't seem to be parsed correctly |
@ungoldman It's interesting. const changelogParser = require('changelog-parser')
changelogParser({
filePath: './CHANGELOG.md',
}).then(res => {
// console.log(res)
}) CHANGELOG.md file: # test change log
All notable changes to this project will be documented in this file.
Project versioning adheres to [Semantic Versioning](http://semver.org/).
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
## [0.1.1] - 2019-8-16
- test
## [0.1.0] - 2019-8-15
- 0.1.0 desc...
I used PowerShell and WSL tests under Windows 10 respectively. This is the test result: |
I have been checking why in windows our changelog was not parsed correctly and I found out that if the CHANGELOG uses LF as EOF when you parsed it in windows it will fail because it is not the correct EOF, it should be CRLF. So before parsing the file it should be converted to the EOF used in the current OS. (Or at least for us it was solved just changing the EOF to CRLF and it is working fine in Mac and Windows). |
Closing in favor of #34 as that sums up the issue more precisely |
It seems that when parsing a change-log file across Linux and Windows, the output object is different.
When parsing a change-log on windows, the title field is filled but the body is empty, on Mac it's the opposite...
Windows Output
Linux Output
https://github.com/hypermodules/changelog-parser/blob/ef3202f250019b46692c234d5c6d354795255e4a/index.js#L83 could possibly be a good place to investigate
The text was updated successfully, but these errors were encountered: