lyrics-structure 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +49 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,6 +7,7 @@ A utility library for structuring and formatting song lyrics and text content.
7
7
  - Split text into natural sections based on structure
8
8
  - Process bracketed content while maintaining structure
9
9
  - Intelligent text segmentation for readability
10
+ - Efficient handling of repeated sections with simple tag references
10
11
 
11
12
  ## Usage
12
13
 
@@ -20,6 +21,54 @@ const parts = getParts(text);
20
21
  const slideParts = getSlideParts(text, maxLinesPerSlide);
21
22
  ```
22
23
 
24
+ ## Bracketed Content Format
25
+
26
+ When structuring your lyrics or text content:
27
+ - Define a section with both opening and closing tags: `[section]content[/section]`
28
+ - For repeated sections, simply use the tag name again: `[section]`
29
+ - The library will automatically reuse the content from the first definition
30
+
31
+ This approach eliminates redundancy and makes lyric management much simpler, especially for songs with repeated choruses or sections.
32
+
33
+ ## Example
34
+
35
+ ```typescript
36
+ // Example with bracketed content
37
+ const lyrics = `[verse1]
38
+ Morning light breaks through my window
39
+ Another day to find my way
40
+ The journey starts with just one step
41
+ I'm moving forward, come what may
42
+ [/verse1]
43
+
44
+ [chorus]
45
+ This is the moment, this is the time
46
+ Hearts united, rhythm and rhyme
47
+ Together we rise, together we stand
48
+ Voices in harmony across the land
49
+ [/chorus]
50
+
51
+ [verse2]
52
+ Challenges come and challenges go
53
+ But strength inside continues to grow
54
+ With every obstacle that I face
55
+ I find my courage, I find my place
56
+ [/verse2]
57
+
58
+ [chorus]`;
59
+
60
+ // Get the individual parts (verses and chorus)
61
+ const parts = getParts(lyrics);
62
+ console.log(parts);
63
+ // Output will be an array with the content of verse1, chorus, verse2, and chorus again
64
+ // Note that [chorus] is referenced twice but only defined once
65
+
66
+ // Get slide-friendly sections
67
+ const slides = getSlideParts(lyrics, 4);
68
+ console.log(slides);
69
+ // Output will break the content into slide-sized chunks with at most 4 lines each
70
+ ```
71
+
23
72
  ## Implementation
24
73
 
25
74
  This library is used in the Stage app ([stage.loha.dev](https://stage.loha.dev)) for lyrics display and presentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyrics-structure",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {