chordsheetjs-extras
v0.1.2
Published
A JavaScript library of extras for ChordSheetJS
Downloads
7
Readme
ChordSheetJS-Extras
A JavaScript library of extras for ChordSheetJS
Based in part on code from ChordSheetJS by Martijn Versluis.
Contents
Installation
ChordSheetJS-Extras
is on npm, to install run:
npm install chordsheetjs-extras
Make sure to install ChordSheetJS
; it is a peer dependency. Extras can be used without it... but we don't know why you would.
npm install chordsheetjs
Load with import
:
import ChordSheetJS from 'chordsheetjs';
import ChordSheetJSExtras from 'chordsheetjs-extras';
or require()
:
var ChordSheetJS = require('chordsheetjs').default;
var ChordSheetJSExtras = require('chordsheetjs-extras');
How to ...?
Display a parsed sheet
HTML format
Table-based layout, extended!
const chordSheet = `
{title: Let it be}
{subtitle: ChordSheetJS example version}
{artist: John Lennon, Paul McCartney}
{key: C}
{tempo: 80}
{time: 4/4}
{Chorus}
Let it [Am]be, let it [C/G]be, let it [F]be, let it [C]be
[C]Whisper words of [G]wisdom, let it [F]be [C/E] [Dm] [C]`.substring(1);
const parser = new ChordSheetJS.ChordProParser();
const song = parser.parse(chordSheet);
const formatter = new ChordSheetJSExtras.HtmlTableExtFormatter();
const disp = formatter.format(song);
API docs
Note: all classes, methods and constants that are documented here can be considered public API and will only be subject to breaking changes between major versions.
HtmlTableExtFormatter
Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like PDF conversion.
Kind: global class
htmlTableExtFormatter.format(song) ⇒ string
Formats a song into HTML.
Kind: instance method of HtmlTableExtFormatter
Returns: string - The HTML string
| Param | Type | Description | | --- | --- | --- | | song | Song | The song to be formatted |