barmark 0.6.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -9,6 +9,24 @@ Releases follow the process in [RELEASING.md](RELEASING.md).
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.7.0] - 2026-11-02
13
+
14
+ Print a chart you have already parsed, and conformance fixtures from real
15
+ charts. No grammar change: every chart reads as before. Implements the
16
+ [grammar v0.1 draft](https://github.com/kevinpeckham/barmark/blob/main/docs/grammar-v0.1-draft.md).
17
+
18
+ ### Added
19
+
20
+ - **`printParsed(text, parsed)`**: the canonical text from a `parseChart`
21
+ result you already have, so a caller that needs both the parse and the
22
+ printed chart reads the text once.
23
+ - The stem-bench conformance fixtures (`tests/conformance/`): the four
24
+ public Badverbs charts exactly as stored in Stem Shovel, with expected
25
+ readings derived from the band's declared section starts and
26
+ stem-bench's independently-built verified bar lists (Study 16), plus
27
+ the grammar's trap rules as tests. A parser change that alters what a
28
+ real chart means now fails CI before it ships.
29
+
12
30
  ## [0.6.0] - 2026-11-01
13
31
 
14
32
  Transposition, and scale degrees for numeral views. No grammar change:
@@ -142,7 +160,8 @@ The first working release: the reference parser and printer for the
142
160
 
143
161
  - **A placeholder package that holds the `barmark` name** while the spec and parser are written.
144
162
 
145
- [Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.6.0...HEAD
163
+ [Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.7.0...HEAD
164
+ [0.7.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.6.0...barmark-v0.7.0
146
165
  [0.6.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.5.0...barmark-v0.6.0
147
166
  [0.5.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.4.0...barmark-v0.5.0
148
167
  [0.4.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.3.0...barmark-v0.4.0
package/README.md CHANGED
@@ -35,7 +35,15 @@ declarations included and no runtime dependencies.
35
35
  ## Use
36
36
 
37
37
  ```ts
38
- import { degreeOf, harteToBarmark, parseChart, parseChord, printChart, transposeChart } from "barmark";
38
+ import {
39
+ degreeOf,
40
+ harteToBarmark,
41
+ parseChart,
42
+ parseChord,
43
+ printChart,
44
+ printParsed,
45
+ transposeChart,
46
+ } from "barmark";
39
47
 
40
48
  const chart = parseChart(text);
41
49
  chart.title; // "Example Song"
@@ -44,6 +52,7 @@ chart.sections; // each section as played, with its first and last bar
44
52
  chart.diagnostics; // errors and warnings, each with a line number
45
53
 
46
54
  printChart(text); // the chart in canonical form (same meaning, standard spelling)
55
+ printParsed(text, chart); // the same, from a parse you already have
47
56
 
48
57
  transposeChart("key: D\n| D | A | Bm | G |", { to: "Eb" }).text; // "key: Eb\n| Eb | Bb | Cm | Ab |\n"
49
58
  transposeChart(text, { semitones: -2 }); // { text, diagnostics }
@@ -60,7 +69,8 @@ harteToBarmark("A:sus4(b7,9)"); // "A9sus4"
60
69
  - **`parseChart`** never throws. A line with an error is left out of the
61
70
  play order and reported, and the rest of the chart still reads.
62
71
  - **`printChart`** changes spelling and layout only: lines with errors and
63
- lyrics print exactly as written.
72
+ lyrics print exactly as written. **`printParsed`** does the same from an
73
+ existing `parseChart` result, for a caller that needs both.
64
74
  - **`transposeChart`** moves every chord root, slash bass, note set and
65
75
  `key:` line, and never the words. Chords are spelled by their interval
66
76
  from the chart's first key, so each keeps its place in the key: C in D
@@ -4,6 +4,6 @@ export { beatsOf, DIRECTIVE_NAMES, parseDirectiveLine, parseMeter } from "./dire
4
4
  export { readDocument } from "./document.js";
5
5
  export { expand, flattenBars, MAX_EXPANDED_BARS } from "./expand.js";
6
6
  export { parseChart } from "./parse.js";
7
- export { printCell, printChart, printLine, printSlot, reduceSlots } from "./print.js";
7
+ export { printCell, printChart, printLine, printParsed, printSlot, reduceSlots } from "./print.js";
8
8
  export { type TransposeBy, transposeChart } from "./transpose.js";
9
9
  export type * from "./types.js";
@@ -4,5 +4,5 @@ export { beatsOf, DIRECTIVE_NAMES, parseDirectiveLine, parseMeter } from "./dire
4
4
  export { readDocument } from "./document.js";
5
5
  export { expand, flattenBars, MAX_EXPANDED_BARS } from "./expand.js";
6
6
  export { parseChart } from "./parse.js";
7
- export { printCell, printChart, printLine, printSlot, reduceSlots } from "./print.js";
7
+ export { printCell, printChart, printLine, printParsed, printSlot, reduceSlots } from "./print.js";
8
8
  export { transposeChart } from "./transpose.js";
@@ -23,5 +23,8 @@ export declare function printLine(l: Line, beats?: (number | undefined)[]): stri
23
23
  * fences stay. Never throws.
24
24
  */
25
25
  export declare function printChart(text: string): string;
26
- /** `printChart` over an existing parse, with each line it prints passed through `edit` first. */
27
- export declare function printParsed(text: string, parsed: ChartParse, edit: (l: Line) => Line): string;
26
+ /**
27
+ * `printChart` over a parse you already have (`parseChart(text)`), so the
28
+ * text isn't read twice. `edit`, if given, changes each line before it prints.
29
+ */
30
+ export declare function printParsed(text: string, parsed: ChartParse, edit?: (l: Line) => Line): string;
@@ -106,10 +106,13 @@ export function printLine(l, beats = []) {
106
106
  * fences stay. Never throws.
107
107
  */
108
108
  export function printChart(text) {
109
- return printParsed(text, parseChart(text), (l) => l);
109
+ return printParsed(text, parseChart(text));
110
110
  }
111
- /** `printChart` over an existing parse, with each line it prints passed through `edit` first. */
112
- export function printParsed(text, parsed, edit) {
111
+ /**
112
+ * `printChart` over a parse you already have (`parseChart(text)`), so the
113
+ * text isn't read twice. `edit`, if given, changes each line before it prints.
114
+ */
115
+ export function printParsed(text, parsed, edit = (l) => l) {
113
116
  const byLine = new Map(parsed.lines.map((l) => [l.line, l]));
114
117
  const errored = new Set(parsed.diagnostics.filter((d) => d.severity === "error").map((d) => d.line));
115
118
  // Each cell's beat count on its first play, which is when its slot count is checked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barmark",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Markdown-inspired plain-text notation for chord charts: a parser, a canonical printer and Harte-label conversion.",
5
5
  "type": "module",
6
6
  "exports": {