keep-a-changelog 2.0.0-beta → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/src/parser.js CHANGED
@@ -82,7 +82,7 @@ function tokenize(markdown) {
82
82
  markdown
83
83
  .trim()
84
84
  .split("\n")
85
- .map((line, index) => {
85
+ .map((line, index, allLines) => {
86
86
  const lineNumber = index + 1;
87
87
  if (line.startsWith("---")) {
88
88
  return [lineNumber, "hr", ["-"]];
@@ -105,6 +105,16 @@ function tokenize(markdown) {
105
105
  if (line.match(/^\[.*\]\:\s*http.*$/)) {
106
106
  return [lineNumber, "link", [line.trim()]];
107
107
  }
108
+ if (line.match(/^\[.*\]\:$/)) {
109
+ const nextLine = allLines[index + 1];
110
+ if (nextLine && nextLine.match(/\s+http.*$/)) {
111
+ // We found a multi-line link: treat it like a single line
112
+ allLines[index + 1] = "";
113
+ return [lineNumber, "link", [
114
+ line.trim() + "\n" + nextLine.trimEnd(),
115
+ ]];
116
+ }
117
+ }
108
118
  const result = line.match(/^<!--(.*)-->$/);
109
119
  if (result) {
110
120
  return [lineNumber, "flag", [result[1].trim()]];
@@ -179,9 +179,12 @@ and this project adheres to
179
179
  - Good examples and basic guidelines, including proper date formatting.
180
180
  - Counter-examples: "What makes unicorns cry?"
181
181
 
182
- [Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
183
- [1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
184
- [0.3.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
182
+ [Unreleased]:
183
+ https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
184
+ [1.0.0]:
185
+ https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
186
+ [0.3.0]:
187
+ https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
185
188
  [0.2.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...v0.2.0
186
189
  [0.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.8...v0.1.0
187
190
  [0.0.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.7...v0.0.8
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "changelog": "./esm/bin.js"
7
7
  },
8
8
  "name": "keep-a-changelog",
9
- "version": "2.0.0-beta",
9
+ "version": "2.0.0",
10
10
  "description": "Node package to parse and generate changelogs following the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.",
11
11
  "homepage": "https://github.com/oscarotero/keep-a-changelog#readme",
12
12
  "license": "MIT",
@@ -19,7 +19,7 @@ export default class Release {
19
19
  removed(change: Change | string): this;
20
20
  fixed(change: Change | string): this;
21
21
  security(change: Change | string): this;
22
- toString(changelog: Changelog): string;
23
- getCompareLink(changelog: Changelog): string | undefined;
22
+ toString(changelog?: Changelog): string;
23
+ getCompareLink(changelog?: Changelog): string | undefined;
24
24
  getLinks(changelog: Changelog): string[];
25
25
  }
@@ -1,7 +1,8 @@
1
- export default function _default(version: any, date: any, description: any): CustomRelease;
1
+ import { Release, Change } from "../../mod.js";
2
+ import { Semver } from "../../src/deps.js";
2
3
  declare class CustomRelease extends Release {
3
- constructor(version: any, date: any, description: any);
4
- maintenance(change: any): CustomRelease;
4
+ constructor(version?: Semver | string, date?: Date | string, description?: string);
5
+ maintenance(change: string | Change): this;
5
6
  }
6
- import { Release } from "../../mod.js";
7
+ export default function (version?: Semver | string, date?: Date | string, description?: string): CustomRelease;
7
8
  export {};
package/umd/src/parser.js CHANGED
@@ -96,7 +96,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
96
96
  markdown
97
97
  .trim()
98
98
  .split("\n")
99
- .map((line, index) => {
99
+ .map((line, index, allLines) => {
100
100
  const lineNumber = index + 1;
101
101
  if (line.startsWith("---")) {
102
102
  return [lineNumber, "hr", ["-"]];
@@ -119,6 +119,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
119
119
  if (line.match(/^\[.*\]\:\s*http.*$/)) {
120
120
  return [lineNumber, "link", [line.trim()]];
121
121
  }
122
+ if (line.match(/^\[.*\]\:$/)) {
123
+ const nextLine = allLines[index + 1];
124
+ if (nextLine && nextLine.match(/\s+http.*$/)) {
125
+ // We found a multi-line link: treat it like a single line
126
+ allLines[index + 1] = "";
127
+ return [lineNumber, "link", [
128
+ line.trim() + "\n" + nextLine.trimEnd(),
129
+ ]];
130
+ }
131
+ }
122
132
  const result = line.match(/^<!--(.*)-->$/);
123
133
  if (result) {
124
134
  return [lineNumber, "flag", [result[1].trim()]];
@@ -179,9 +179,12 @@ and this project adheres to
179
179
  - Good examples and basic guidelines, including proper date formatting.
180
180
  - Counter-examples: "What makes unicorns cry?"
181
181
 
182
- [Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
183
- [1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
184
- [0.3.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
182
+ [Unreleased]:
183
+ https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
184
+ [1.0.0]:
185
+ https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
186
+ [0.3.0]:
187
+ https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
185
188
  [0.2.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...v0.2.0
186
189
  [0.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.8...v0.1.0
187
190
  [0.0.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.7...v0.0.8