A JavaScript library for parsing and formatting chord sheets
ChordSheetJS
is on npm, to install run:
npm install chordsheetjs
Load with require()
:
var ChordSheetJS = require('chordsheetjs');
or import
(es2015):
import ChordSheetJS from 'chordsheetjs';
It is also possible to download or clone the repository. When you load one of
the compiled packages in the dist/
folder, you can use window.ChordSheetJS
in the
browser.
Assuming a chord sheet:
var chordSheet =
"G \n" +
"Stand by me, \n" +
" Em \n" +
"Oh now, now, stand by me.\n" +
"C \n" +
"Stand by me, \n" +
"D \n" +
"Stand by me, \n" +
"G \n" +
"Stand by me. \n";
var parser = new ChordSheetJS.ChordSheetParser();
var song = parser.parse(chordSheet);
var parser = new ChordSheetJS.ChordProParser();
var song = parser.parse(chordSheet);
var formatter = new ChordSheetJS.TextFormatter();
var disp = formatter.format(song);
var formatter = new ChordSheetJS.HtmlFormatter();
var disp = formatter.format(song);
var formatter = new ChordSheetJS.ChordProFormatter();
var disp = formatter.format(song);