🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

js-chordpro

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-chordpro

ChordPro format parser

2.2.3
latest
Source
npm
Version published
Weekly downloads
2
-96.49%
Maintainers
1
Weekly downloads
 
Created
Source

ChordPro

Javscript implementation of parser for song lyrics writted in ChordPro format.

How to build and deploy

Install dependences:

npm install

Compile grammar to js:

npm run grammar

Start development mode (package is built on each change in source code):

npm run dev

Build package for deploymet:

npm run build

ChordPro Format Coverage

Preamble directives

  • new_song, ns

Meta-data directives

  • title, t, meta: title
  • subtitle, st
  • artist, meta: artist
  • composer, meta: composer
  • lyricist, meta: lyricist
  • copyright, meta: copyright
  • album, meta: album
  • year, meta: year
  • key, meta: key
  • time, meta: time
  • tempo, meta: tempo
  • duration, meta: duration
  • capo, meta: capo
  • meta

Formatting directives

  • comment, c
  • comment_italic, ci
  • comment_box, cb
  • image

Environment directives

  • start_of_chorus, soc
  • end_of_chorus, eoc
  • chorus
  • start_of_verse
  • end_of_verse
  • start_of_tab, sot)
  • end_of_tab, eot)
  • start_of_grid
  • end_of_grid

Chord diagrams

  • define
  • chord

Fonts, sizes and colours

  • textfont
  • textsize
  • textcolour
  • chordfont
  • chordsize
  • chordcolour
  • tabfont
  • tabsize
  • tabcolour

Output related directives

  • new_page, np

  • new_physical_page, npp)

  • column_break, cb

  • grid, g

  • no_grid, ng

  • titles

  • columns, col

Custom extensions

  • x_

Quick Start

var chordpro = require('js-chordpro');

// Song to be parsed
const song_chordpro = `
{title: Some Song}

[G]This is first [C]verse
with [G]chords
`;

// tokenize and parse song into in-memory song document structure
let parsed = jschordpro.parse(song_chordpro)

// render in-memory song document to html
let html = jschordpro.to_html(doc);

console.log(html);

Use as cli tool

Package provides cli command jschordpro.

Following command will register package as cli command in case you don't install it as npm package (e.g. in case of git clone)

npm link

Resources

Keywords

chordpro

FAQs

Package last updated on 11 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts