lyrics-structure
Version:
Parser for lyrics with structured sections, names, and indications
54 lines (38 loc) • 993 B
Markdown
A TypeScript library for parsing lyrics with bracketed sections and special commands. Supports splitting text into structured parts with names and indications.
```bash
npm install lyrics-parser
```
```typescript
import { getLyricsParts } from 'lyrics-parser';
const lyrics = `[verse 1] (first time)
This is the first verse content
[/verse 1]
[]
This is the chorus content
[/chorus]
[]
This is the second verse content
[/verse 2]`;
const parts = getLyricsParts(lyrics);
// Result: Array of LyricPart objects with name, repetition, indication, and content
```
- Extracts content from bracketed sections
- Handles section names and indications
- Supports repeated sections
- Preserves non-bracketed content
- TypeScript support
```text
[] (indication)
content
[/partname]
[]
more content
[/another part]
```
MIT