lyrics-structure
v1.2.4
Published
Parser for lyrics with structured sections, names, and indications
Downloads
201
Readme
Lyrics Parser
A TypeScript library for parsing lyrics with bracketed sections and special commands. Supports splitting text into structured parts with names and indications.
Installation
npm install lyrics-parserUsage
import { getLyricsParts } from 'lyrics-parser';
const lyrics = `[verse 1] (first time)
This is the first verse content
[/verse 1]
[chorus]
This is the chorus content
[/chorus]
[verse 2]
This is the second verse content
[/verse 2]`;
const parts = getLyricsParts(lyrics);
// Result: Array of LyricPart objects with name, repetition, indication, and contentFeatures
- Extracts content from bracketed sections
- Handles section names and indications
- Supports repeated sections
- Preserves non-bracketed content
- TypeScript support
Example Format
[partname] (indication)
content
[/partname]
[another part]
more content
[/another part]License
MIT
