@forthtilliath/ts-kit 0.12.0 → 0.13.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/README.md
CHANGED
|
@@ -210,7 +210,7 @@ Building blocks for writing an iCalendar (`.ics`, RFC 5545) file.
|
|
|
210
210
|
### `markdown`
|
|
211
211
|
|
|
212
212
|
- `parseChangelogNotes(notes)` — parses a small subset of Markdown
|
|
213
|
-
(
|
|
213
|
+
(`#` to `###### heading`, `- item`, `**bold**`) commonly found in GitHub release
|
|
214
214
|
notes into a list of typed blocks (`heading` / `item` / `text`, each with
|
|
215
215
|
`bold`-aware segments), ready for a UI layer to render without a full
|
|
216
216
|
Markdown dependency.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseChangelogNotes.d.ts","sourceRoot":"","sources":["../../src/markdown/parseChangelogNotes.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"parseChangelogNotes.d.ts","sourceRoot":"","sources":["../../src/markdown/parseChangelogNotes.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AA0BnD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAqBnE"}
|
|
@@ -23,14 +23,21 @@ function parseInlineSegments(text) {
|
|
|
23
23
|
}
|
|
24
24
|
return segments;
|
|
25
25
|
}
|
|
26
|
+
// Any ATX heading level ("# " to "###### ") — release notes are not always
|
|
27
|
+
// written with "###" (e.g. "## What's new" on a hand-written GitHub release).
|
|
28
|
+
const headingPattern = /^#{1,6}\s+/;
|
|
26
29
|
export function parseChangelogNotes(notes) {
|
|
27
30
|
return notes
|
|
28
31
|
.split("\n")
|
|
29
32
|
.map((line) => line.trim())
|
|
30
33
|
.filter((line) => line.length > 0)
|
|
31
34
|
.map((line) => {
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
const heading = headingPattern.exec(line);
|
|
36
|
+
if (heading) {
|
|
37
|
+
return {
|
|
38
|
+
type: "heading",
|
|
39
|
+
text: line.slice(heading[0].length).trim(),
|
|
40
|
+
};
|
|
34
41
|
}
|
|
35
42
|
if (line.startsWith("- ")) {
|
|
36
43
|
return {
|