From a66f96e395197d4fa659841228c48d96f3d8c7b9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 18 Sep 2024 18:23:45 +0000
Subject: [PATCH 1/2] Bump jsdoc-to-markdown from 8.0.3 to 9.0.1
Bumps [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown) from 8.0.3 to 9.0.1.
- [Release notes](https://github.com/jsdoc2md/jsdoc-to-markdown/releases)
- [Commits](https://github.com/jsdoc2md/jsdoc-to-markdown/compare/v8.0.3...v9.0.1)
---
updated-dependencies:
- dependency-name: jsdoc-to-markdown
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song) Represents a chord with the corresponding (partial) lyrics
+
Represents a song in a chord sheet. Currently a chord sheet can only have one song.
Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/
Represents a Chord, consisting of a root, suffix (quality) and bass
Formats a song into a ChordPro chord sheet
Formats a song into a plain text chord sheet
Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
+The only function considered public API is Key.distance
Parses a ChordPro chord sheet
Parses an Ultimate Guitar chord sheet with metadata Inherits from [ChordSheetParser](#ChordSheetParser)
Represents a Chord, consisting of a root, suffix (quality) and bass
Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)
Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
-The only function considered public API is Key.distance
Returns applicable keys to transpose to from the provided key
Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)
+ +**Kind**: global class + +* [ChordSheetSerializer](#ChordSheetSerializer) + * [.serialize()](#ChordSheetSerializer+serialize) ⇒ + * [.deserialize(serializedSong)](#ChordSheetSerializer+deserialize) ⇒ [Song
](#Song)
+
+
+
+### chordSheetSerializer.serialize() ⇒
+Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc +Can be deserialized using [deserialize](deserialize)
+ +**Kind**: instance method of [ChordSheetSerializer
](#ChordSheetSerializer)
+**Returns**: object A plain JS object containing all chord sheet data
+ + +### chordSheetSerializer.deserialize(serializedSong) ⇒ [Song
](#Song)
+Deserializes a song that has been serialized using [serialize](serialize)
+ +**Kind**: instance method of [ChordSheetSerializer
](#ChordSheetSerializer)
+**Returns**: [Song
](#Song) - The deserialized song
+ +| Param | Type | Description | +| --- | --- | --- | +| serializedSong |object
| The serialized song
| + ## ChordLyricsPair @@ -1142,637 +1173,606 @@ https://chordpro.org/chordpro/directives-env_bridge/, https://chordpro.org/chord **Kind**: instance method of [Tag
](#Tag)
**Returns**: [Tag
](#Tag) - The cloned tag
- + -## ChordProFormatter -Formats a song into a ChordPro chord sheet
+## Chord +Represents a Chord, consisting of a root, suffix (quality) and bass
**Kind**: global class - -### chordProFormatter.format(song) ⇒string
-Formats a song into a ChordPro chord sheet.
+* [Chord](#Chord) + * _instance_ + * [.clone()](#Chord+clone) ⇒ [Chord
](#Chord)
+ * [.toChordSymbol([referenceKey])](#Chord+toChordSymbol) ⇒ [Chord
](#Chord)
+ * [.toChordSymbolString([referenceKey])](#Chord+toChordSymbolString) ⇒ string
+ * [.isChordSymbol()](#Chord+isChordSymbol) ⇒ boolean
+ * [.toChordSolfege([referenceKey])](#Chord+toChordSolfege) ⇒ [Chord
](#Chord)
+ * [.toChordSolfegeString([referenceKey])](#Chord+toChordSolfegeString) ⇒ string
+ * [.isChordSolfege()](#Chord+isChordSolfege) ⇒ boolean
+ * [.toNumeric([referenceKey])](#Chord+toNumeric) ⇒ [Chord
](#Chord)
+ * [.toNumeral([referenceKey])](#Chord+toNumeral) ⇒ [Chord
](#Chord)
+ * [.toNumeralString([referenceKey])](#Chord+toNumeralString) ⇒ string
+ * [.isNumeric()](#Chord+isNumeric) ⇒ boolean
+ * [.toNumericString([referenceKey])](#Chord+toNumericString) ⇒ string
+ * [.isNumeral()](#Chord+isNumeral) ⇒ boolean
+ * [.toString([configuration])](#Chord+toString) ⇒ string
+ * [.normalize([key], [options])](#Chord+normalize) ⇒ [Chord
](#Chord)
+ * [.useModifier(newModifier)](#Chord+useModifier) ⇒ [Chord
](#Chord)
+ * [.transposeUp()](#Chord+transposeUp) ⇒ [Chord
](#Chord)
+ * [.transposeDown()](#Chord+transposeDown) ⇒ [Chord
](#Chord)
+ * [.transpose(delta)](#Chord+transpose) ⇒ [Chord
](#Chord)
+ * _static_
+ * [.parse(chordString)](#Chord.parse) ⇒ [Chord
](#Chord) \| null
-**Kind**: instance method of [ChordProFormatter
](#ChordProFormatter)
-**Returns**: string
- The ChordPro string
+ -| Param | Type | Description | -| --- | --- | --- | -| song | [Song
](#Song) | The song to be formatted
| +### chord.clone() ⇒ [Chord
](#Chord)
+Returns a deep copy of the chord
- +**Kind**: instance method of [Chord
](#Chord)
+
-## ChordsOverWordsFormatter
-Formats a song into a plain text chord sheet
+### chord.toChordSymbol([referenceKey]) ⇒ [Chord
](#Chord)
+Converts the chord to a chord symbol, using the supplied key as a reference.
+For example, a numeric chord #4
with reference key E
will return the chord symbol A#
.
+When the chord is already a chord symbol, it will return a clone of the object.
Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the chord symbol
-### chordsOverWordsFormatter.format(song) ⇒string
-Formats a song into a plain text chord sheet
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| -**Kind**: instance method of [ChordsOverWordsFormatter
](#ChordsOverWordsFormatter)
-**Returns**: string
- the chord sheet
+ -| Param | Type | Description | -| --- | --- | --- | -| song | [Song
](#Song) | The song to be formatted
| +### chord.toChordSymbolString([referenceKey]) ⇒string
+Converts the chord to a chord symbol string, using the supplied key as a reference.
+For example, a numeric chord #4
with reference key E
will return the chord symbol A#
.
+When the chord is already a chord symbol, it will return a string version of the chord.
Chord
](#Chord)
+**Returns**: string
- the chord symbol string
+**See**: {toChordSymbol} -## Formatter -Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| -**Kind**: global class - + -### new Formatter([configuration]) -Instantiate
+### chord.isChordSymbol() ⇒boolean
+Determines whether the chord is a chord symbol
+ +**Kind**: instance method of [Chord
](#Chord)
+
+
+### chord.toChordSolfege([referenceKey]) ⇒ [Chord
](#Chord)
+Converts the chord to a chord solfege, using the supplied key as a reference.
+For example, a numeric chord #4
with reference key Mi
will return the chord symbol La#
.
+When the chord is already a chord solfege, it will return a clone of the object.
Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the chord solfege
| Param | Type | Default | Description | | --- | --- | --- | --- | -| [configuration] |Object
| {}
| options
| -| [configuration.evaluate] |boolean
| false
| Whether or not to evaluate meta expressions. For more info about meta expressions, see: https://bit.ly/2SC9c2u
| -| [configuration.metadata] |object
| {}
| |
-| [configuration.metadata.separator] | string
| "\", \""
| The separator to be used when rendering a metadata value that has multiple values. See: https://bit.ly/2SC9c2u
| -| [configuration.key] | [Key
](#Key) \| string
|
| The key to use for rendering. The chord sheet will be transposed from the song's original key (as indicated by the {key}
directive) to the specified key. Note that transposing will only work if the original song key is set.
boolean
| false
| Whether or not to expand {chorus}
directives by rendering the last defined chorus inline after the directive.
boolean
| false
| Whether or not to use unicode flat and sharp symbols.
| -| [configuration.normalizeChords] |boolean
| true
| Whether or not to automatically normalize chords
| +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| - + -## HtmlDivFormatter -Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
+### chord.toChordSolfegeString([referenceKey]) ⇒string
+Converts the chord to a chord solfege string, using the supplied key as a reference.
+For example, a numeric chord #4
with reference key E
will return the chord solfege A#
.
+When the chord is already a chord solfege, it will return a string version of the chord.
Chord
](#Chord)
+**Returns**: string
- the chord solfege string
+**See**: {toChordSolfege} -## HtmlFormatter -Acts as a base class for HTML formatters
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| -**Kind**: global class + -* [HtmlFormatter](#HtmlFormatter) - * [.cssObject](#HtmlFormatter+cssObject) ⇒Object.<string, Object.<string, string>>
- * [.format(song)](#HtmlFormatter+format) ⇒ string
- * [.cssString(scope)](#HtmlFormatter+cssString) ⇒ string
+### chord.isChordSolfege() ⇒ boolean
+Determines whether the chord is a chord solfege
- +**Kind**: instance method of [Chord
](#Chord)
+
-### htmlFormatter.cssObject ⇒ Object.<string, Object.<string, string>>
-Basic CSS, in object style à la useStyles, to use with the HTML output -For a CSS string see [cssString](cssString)
-Example:
-'.paragraph': {
- marginBottom: '1em'
-}
-
+### chord.toNumeric([referenceKey]) ⇒ [Chord
](#Chord)
+Converts the chord to a numeric chord, using the supplied key as a reference. +For example, a chord symbol A# with reference key E will return the numeric chord #4.
-**Kind**: instance property of [HtmlFormatter
](#HtmlFormatter)
-**Returns**: Object.<string, Object.<string, string>>
- the CSS object
- +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the numeric chord
-### htmlFormatter.format(song) ⇒string
-Formats a song into HTML.
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| -**Kind**: instance method of [HtmlFormatter
](#HtmlFormatter)
-**Returns**: string
- The HTML string
+ -| Param | Type | Description | -| --- | --- | --- | -| song | [Song
](#Song) | The song to be formatted
| +### chord.toNumeral([referenceKey]) ⇒ [Chord
](#Chord)
+Converts the chord to a numeral chord, using the supplied key as a reference. +For example, a chord symbol A# with reference key E will return the numeral chord #IV.
- +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the numeral chord
-### htmlFormatter.cssString(scope) ⇒string
-Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
-For example, execute cssString('.chordSheetViewer') will result in CSS like:
-.chordSheetViewer .paragraph {
- margin-bottom: 1em;
-}
-
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| -**Kind**: instance method of [HtmlFormatter
](#HtmlFormatter)
-**Returns**: string
- the CSS string
+ -| Param | Description | -| --- | --- | -| scope |the CSS scope to use, for example .chordSheetViewer
string
+Converts the chord to a numeral chord string, using the supplied kye as a reference. +For example, a chord symbol A# with reference key E will return the numeral chord #4.
- +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: string
- the numeral chord string
+**See**: {toNumeral} -## HtmlTableFormatter -Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like -PDF conversion.
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| -**Kind**: global class - + -## TextFormatter -Formats a song into a plain text chord sheet
+### chord.isNumeric() ⇒boolean
+Determines whether the chord is numeric
-**Kind**: global class - +**Kind**: instance method of [Chord
](#Chord)
+
-### textFormatter.format(song) ⇒ string
-Formats a song into a plain text chord sheet
+### chord.toNumericString([referenceKey]) ⇒string
+Converts the chord to a numeric chord string, using the supplied kye as a reference. +For example, a chord symbol A# with reference key E will return the numeric chord #4.
-**Kind**: instance method of [TextFormatter
](#TextFormatter)
-**Returns**: string
- the chord sheet
+**Kind**: instance method of [Chord
](#Chord)
+**Returns**: string
- the numeric chord string
+**See**: {toNumeric} -| Param | Type | Description | -| --- | --- | --- | -| song | [Song
](#Song) | The song to be formatted
| +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| - + -## ChordProParser -Parses a ChordPro chord sheet
+### chord.isNumeral() ⇒boolean
+Determines whether the chord is a numeral
-**Kind**: global class +**Kind**: instance method of [Chord
](#Chord)
+
-* [ChordProParser](#ChordProParser)
- * [.warnings](#ChordProParser+warnings) : [Array.<ParserWarning>
](#ParserWarning)
- * [.parse(chordSheet, options)](#ChordProParser+parse) ⇒ [Song
](#Song)
+### chord.toString([configuration]) ⇒ string
+Converts the chord to a string, eg Esus4/G#
or 1sus4/#3
Chord
](#Chord)
+**Returns**: string
- the chord string
-### chordProParser.warnings : [Array.<ParserWarning>
](#ParserWarning)
-All warnings raised during parsing the chord sheet
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [configuration] |Object
| {}
| options
| +| [configuration.useUnicodeModifier] |boolean
| false
| Whether or not to use unicode modifiers. This will make #
(sharp) look like ♯
and b
(flat) look like ♭
ChordProParser
](#ChordProParser)
-
+
-### chordProParser.parse(chordSheet, options) ⇒ [Song
](#Song)
-Parses a ChordPro chord sheet into a song
+### chord.normalize([key], [options]) ⇒ [Chord
](#Chord)
+Normalizes the chord root and bass notes:
+Besides that it normalizes the suffix if normalizeSuffix
is true
.
+For example, sus2
becomes 2
, sus4
becomes sus
.
+All suffix normalizations can be found in src/normalize_mappings/suffix-mapping.txt
.
When the chord is minor, bass notes are normalized off of the relative major
+of the root note. For example, Em/A#
becomes Em/Bb
.
ChordProParser
](#ChordProParser)
-**Returns**: [Song
](#Song) - The parsed song
-**See**: https://peggyjs.org/documentation.html#using-the-parser +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the normalized chord
| Param | Type | Default | Description | | --- | --- | --- | --- | -| chordSheet |string
| | the ChordPro chord sheet
| -| options |ChordProParserOptions
| | Parser options.
| -| options.softLineBreaks |ChordProParserOptions.softLineBreaks
| false
| If true, a backslash followed by * a space is treated as a soft line break
| - - +| [key] | [Key
](#Key) \| string
|
| the key to normalize to
| +| [options] |Object
| {}
| options
| +| [options.normalizeSuffix] |boolean
| true
| whether to normalize the chord suffix after transposing
| -## ~~ChordSheetParser~~ -***Deprecated*** + -Parses a normal chord sheet
-ChordSheetParser is deprecated, please use ChordsOverWordsParser.
-ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks -support for many variations. Besides that, some chordpro feature have been ported back -to ChordsOverWordsParser, which adds some interesting functionality.
+### chord.useModifier(newModifier) ⇒ [Chord
](#Chord)
+Switches to the specified modifier
-**Kind**: global class +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the new, changed chord
-* ~~[ChordSheetParser](#ChordSheetParser)~~ - * [new ChordSheetParser([options])](#new_ChordSheetParser_new) - * [.parse(chordSheet, [options])](#ChordSheetParser+parse) ⇒ [Song
](#Song)
+| Param | Description |
+| --- | --- |
+| newModifier | the modifier to use: '#'
or 'b'
Instantiate a chord sheet parser -ChordSheetParser is deprecated, please use ChordsOverWordsParser.
+### chord.transposeUp() ⇒ [Chord
](#Chord)
+Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E
+**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the new, transposed chord
+ -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] |Object
| {}
| options
| -| [options.preserveWhitespace] |boolean
| true
| whether to preserve trailing whitespace for chords
| +### chord.transposeDown() ⇒ [Chord
](#Chord)
+Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb
- +**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the new, transposed chord
+ -### chordSheetParser.parse(chordSheet, [options]) ⇒ [Song
](#Song)
-Parses a chord sheet into a song
+### chord.transpose(delta) ⇒ [Chord
](#Chord)
+Transposes the chord by the specified number of semitones
-**Kind**: instance method of [ChordSheetParser
](#ChordSheetParser)
-**Returns**: [Song
](#Song) - The parsed song
+**Kind**: instance method of [Chord
](#Chord)
+**Returns**: [Chord
](#Chord) - the new, transposed chord
-| Param | Type | Default | Description | -| --- | --- | --- | --- | -| chordSheet |string
| | The ChordPro chord sheet
| -| [options] |Object
| {}
| Optional parser options
| -| [options.song] | [Song
](#Song) |
| The [Song](#Song) to store the song data in
| +| Param | Description | +| --- | --- | +| delta |de number of semitones
| - + -## ChordsOverWordsParser -Parses a chords over words sheet into a song
-It support "regular" chord sheets:
- Am C/G F C
-Let it be, let it be, let it be, let it be
-C G F C/E Dm C
-Whisper words of wisdom, let it be
-
-Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:
-{title: Let it be}
-{key: C}
-Chorus 1:
- Am
-Let it be
-
-For convenience, you can leave out the brackets:
-title: Let it be
-Chorus 1:
- Am
-Let it be
-
-You can even use a markdown style frontmatter separator to separate the header from the song:
-title: Let it be
-key: C
----
-Chorus 1:
- Am C/G F C
-Let it be, let it be, let it be, let it be
-C G F C/E Dm C
-Whisper words of wisdom, let it be
-
-ChordsOverWordsParser
is the better version of ChordSheetParser
, which is deprecated.
Chord
](#Chord) \| null
+Tries to parse a chord string into a chord
+Any leading or trailing whitespace is removed first, so a chord like \n E/G# \r
is valid.
Chord
](#Chord)
-* [ChordsOverWordsParser](#ChordsOverWordsParser)
- * [.warnings](#ChordsOverWordsParser+warnings) : [Array.<ParserWarning>
](#ParserWarning)
- * [.parse(chordSheet, options)](#ChordsOverWordsParser+parse) ⇒ [Song
](#Song)
+| Param | Description |
+| --- | --- |
+| chordString | the chord string, eg Esus4/G#
or 1sus4/#3
.
Array.<ParserWarning>
](#ParserWarning)
-All warnings raised during parsing the chord sheet
+## ChordProFormatter +Formats a song into a ChordPro chord sheet
-**Kind**: instance property of [ChordsOverWordsParser
](#ChordsOverWordsParser)
-
+**Kind**: global class
+
-### chordsOverWordsParser.parse(chordSheet, options) ⇒ [Song
](#Song)
-Parses a chords over words sheet into a song
+### chordProFormatter.format(song) ⇒string
+Formats a song into a ChordPro chord sheet.
-**Kind**: instance method of [ChordsOverWordsParser
](#ChordsOverWordsParser)
-**Returns**: [Song
](#Song) - The parsed song
-**See**: https://peggyjs.org/documentation.html#using-the-parser +**Kind**: instance method of [ChordProFormatter
](#ChordProFormatter)
+**Returns**: string
- The ChordPro string
-| Param | Type | Default | Description | -| --- | --- | --- | --- | -| chordSheet |string
| | the chords over words sheet
| -| options |ChordsOverWordsParserOptions
| | Parser options.
| -| options.softLineBreaks |ChordsOverWordsParserOptions.softLineBreaks
| false
| If true, a backslash followed by a space is treated as a soft line break
| +| Param | Type | Description | +| --- | --- | --- | +| song | [Song
](#Song) | The song to be formatted
| - + -## ParserWarning -Represents a parser warning, currently only used by ChordProParser.
+## ChordsOverWordsFormatter +Formats a song into a plain text chord sheet
**Kind**: global class - + -### parserWarning.toString() ⇒string
-Returns a stringified version of the warning
+### chordsOverWordsFormatter.format(song) ⇒string
+Formats a song into a plain text chord sheet
-**Kind**: instance method of [ParserWarning
](#ParserWarning)
-**Returns**: string
- The string warning
- +**Kind**: instance method of [ChordsOverWordsFormatter
](#ChordsOverWordsFormatter)
+**Returns**: string
- the chord sheet
-## UltimateGuitarParser -Parses an Ultimate Guitar chord sheet with metadata -Inherits from [ChordSheetParser](#ChordSheetParser)
+| Param | Type | Description | +| --- | --- | --- | +| song | [Song
](#Song) | The song to be formatted
| + + + +## Formatter +Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object
**Kind**: global class - + -### new UltimateGuitarParser([options]) -Instantiate a chord sheet parser
+### new Formatter([configuration]) +Instantiate
| Param | Type | Default | Description | | --- | --- | --- | --- | -| [options] |Object
| {}
| options
| -| [options.preserveWhitespace] |boolean
| true
| whether to preserve trailing whitespace for chords
| +| [configuration] |Object
| {}
| options
| +| [configuration.evaluate] |boolean
| false
| Whether or not to evaluate meta expressions. For more info about meta expressions, see: https://bit.ly/2SC9c2u
| +| [configuration.metadata] |object
| {}
| |
+| [configuration.metadata.separator] | string
| "\", \""
| The separator to be used when rendering a metadata value that has multiple values. See: https://bit.ly/2SC9c2u
| +| [configuration.key] | [Key
](#Key) \| string
|
| The key to use for rendering. The chord sheet will be transposed from the song's original key (as indicated by the {key}
directive) to the specified key. Note that transposing will only work if the original song key is set.
boolean
| false
| Whether or not to expand {chorus}
directives by rendering the last defined chorus inline after the directive.
boolean
| false
| Whether or not to use unicode flat and sharp symbols.
| +| [configuration.normalizeChords] |boolean
| true
| Whether or not to automatically normalize chords
| - + -## Chord -Represents a Chord, consisting of a root, suffix (quality) and bass
+## HtmlDivFormatter +Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.
**Kind**: global class + -* [Chord](#Chord) - * _instance_ - * [.clone()](#Chord+clone) ⇒ [Chord
](#Chord)
- * [.toChordSymbol([referenceKey])](#Chord+toChordSymbol) ⇒ [Chord
](#Chord)
- * [.toChordSymbolString([referenceKey])](#Chord+toChordSymbolString) ⇒ string
- * [.isChordSymbol()](#Chord+isChordSymbol) ⇒ boolean
- * [.toChordSolfege([referenceKey])](#Chord+toChordSolfege) ⇒ [Chord
](#Chord)
- * [.toChordSolfegeString([referenceKey])](#Chord+toChordSolfegeString) ⇒ string
- * [.isChordSolfege()](#Chord+isChordSolfege) ⇒ boolean
- * [.toNumeric([referenceKey])](#Chord+toNumeric) ⇒ [Chord
](#Chord)
- * [.toNumeral([referenceKey])](#Chord+toNumeral) ⇒ [Chord
](#Chord)
- * [.toNumeralString([referenceKey])](#Chord+toNumeralString) ⇒ string
- * [.isNumeric()](#Chord+isNumeric) ⇒ boolean
- * [.toNumericString([referenceKey])](#Chord+toNumericString) ⇒ string
- * [.isNumeral()](#Chord+isNumeral) ⇒ boolean
- * [.toString([configuration])](#Chord+toString) ⇒ string
- * [.normalize([key], [options])](#Chord+normalize) ⇒ [Chord
](#Chord)
- * [.useModifier(newModifier)](#Chord+useModifier) ⇒ [Chord
](#Chord)
- * [.transposeUp()](#Chord+transposeUp) ⇒ [Chord
](#Chord)
- * [.transposeDown()](#Chord+transposeDown) ⇒ [Chord
](#Chord)
- * [.transpose(delta)](#Chord+transpose) ⇒ [Chord
](#Chord)
- * _static_
- * [.parse(chordString)](#Chord.parse) ⇒ [Chord
](#Chord) \| null
-
-
-
-### chord.clone() ⇒ [Chord
](#Chord)
-Returns a deep copy of the chord
- -**Kind**: instance method of [Chord
](#Chord)
-
-
-### chord.toChordSymbol([referenceKey]) ⇒ [Chord
](#Chord)
-Converts the chord to a chord symbol, using the supplied key as a reference.
-For example, a numeric chord #4
with reference key E
will return the chord symbol A#
.
-When the chord is already a chord symbol, it will return a clone of the object.
Acts as a base class for HTML formatters
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the chord symbol
+**Kind**: global class -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| +* [HtmlFormatter](#HtmlFormatter) + * [.cssObject](#HtmlFormatter+cssObject) ⇒Object.<string, Object.<string, string>>
+ * [.format(song)](#HtmlFormatter+format) ⇒ string
+ * [.cssString(scope)](#HtmlFormatter+cssString) ⇒ string
-
+
-### chord.toChordSymbolString([referenceKey]) ⇒ string
-Converts the chord to a chord symbol string, using the supplied key as a reference.
-For example, a numeric chord #4
with reference key E
will return the chord symbol A#
.
-When the chord is already a chord symbol, it will return a string version of the chord.
Object.<string, Object.<string, string>>
+Basic CSS, in object style à la useStyles, to use with the HTML output +For a CSS string see [cssString](cssString)
+Example:
+'.paragraph': {
+ marginBottom: '1em'
+}
+
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: string
- the chord symbol string
-**See**: {toChordSymbol} +**Kind**: instance property of [HtmlFormatter
](#HtmlFormatter)
+**Returns**: Object.<string, Object.<string, string>>
- the CSS object
+ -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| +### htmlFormatter.format(song) ⇒string
+Formats a song into HTML.
- +**Kind**: instance method of [HtmlFormatter
](#HtmlFormatter)
+**Returns**: string
- The HTML string
-### chord.isChordSymbol() ⇒boolean
-Determines whether the chord is a chord symbol
+| Param | Type | Description | +| --- | --- | --- | +| song | [Song
](#Song) | The song to be formatted
| -**Kind**: instance method of [Chord
](#Chord)
-
+
-### chord.toChordSolfege([referenceKey]) ⇒ [Chord
](#Chord)
-Converts the chord to a chord solfege, using the supplied key as a reference.
-For example, a numeric chord #4
with reference key Mi
will return the chord symbol La#
.
-When the chord is already a chord solfege, it will return a clone of the object.
string
+Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output
+For example, execute cssString('.chordSheetViewer') will result in CSS like:
+.chordSheetViewer .paragraph {
+ margin-bottom: 1em;
+}
+
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the chord solfege
+**Kind**: instance method of [HtmlFormatter
](#HtmlFormatter)
+**Returns**: string
- the CSS string
-| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| +| Param | Description | +| --- | --- | +| scope |the CSS scope to use, for example .chordSheetViewer
string
-Converts the chord to a chord solfege string, using the supplied key as a reference.
-For example, a numeric chord #4
with reference key E
will return the chord solfege A#
.
-When the chord is already a chord solfege, it will return a string version of the chord.
Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like +PDF conversion.
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: string
- the chord solfege string
-**See**: {toChordSolfege} +**Kind**: global class + -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a numeric or numeral.
| +## TextFormatter +Formats a song into a plain text chord sheet
- +**Kind**: global class + -### chord.isChordSolfege() ⇒boolean
-Determines whether the chord is a chord solfege
+### textFormatter.format(song) ⇒string
+Formats a song into a plain text chord sheet
-**Kind**: instance method of [Chord
](#Chord)
-
+**Kind**: instance method of [TextFormatter
](#TextFormatter)
+**Returns**: string
- the chord sheet
-### chord.toNumeric([referenceKey]) ⇒ [Chord
](#Chord)
-Converts the chord to a numeric chord, using the supplied key as a reference. -For example, a chord symbol A# with reference key E will return the numeric chord #4.
+| Param | Type | Description | +| --- | --- | --- | +| song | [Song
](#Song) | The song to be formatted
| -**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the numeric chord
+ -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| +## Key +Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
+The only function considered public API is Key.distance
Chord
](#Chord)
-Converts the chord to a numeral chord, using the supplied key as a reference. -For example, a chord symbol A# with reference key E will return the numeral chord #IV.
+### Key.distance(oneKey, otherKey) ⇒number
+Calculates the distance in semitones between one key and another.
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the numeral chord
+**Kind**: static method of [Key
](#Key)
+**Returns**: number
- the distance in semitones
-| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| +| Param | Type | Description | +| --- | --- | --- | +| oneKey | [Key
](#Key) \| string
| the key
| +| otherKey | [Key
](#Key) \| string
| the other key
| - + -### chord.toNumeralString([referenceKey]) ⇒string
-Converts the chord to a numeral chord string, using the supplied kye as a reference. -For example, a chord symbol A# with reference key E will return the numeral chord #4.
+## ChordProParser +Parses a ChordPro chord sheet
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: string
- the numeral chord string
-**See**: {toNumeral} +**Kind**: global class -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| +* [ChordProParser](#ChordProParser) + * [.warnings](#ChordProParser+warnings) : [Array.<ParserWarning>
](#ParserWarning)
+ * [.parse(chordSheet, options)](#ChordProParser+parse) ⇒ [Song
](#Song)
-
+
-### chord.isNumeric() ⇒ boolean
-Determines whether the chord is numeric
+### chordProParser.warnings : [Array.<ParserWarning>
](#ParserWarning)
+All warnings raised during parsing the chord sheet
-**Kind**: instance method of [Chord
](#Chord)
-
+**Kind**: instance property of [ChordProParser
](#ChordProParser)
+
-### chord.toNumericString([referenceKey]) ⇒ string
-Converts the chord to a numeric chord string, using the supplied kye as a reference. -For example, a chord symbol A# with reference key E will return the numeric chord #4.
+### chordProParser.parse(chordSheet, options) ⇒ [Song
](#Song)
+Parses a ChordPro chord sheet into a song
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: string
- the numeric chord string
-**See**: {toNumeric} +**Kind**: instance method of [ChordProParser
](#ChordProParser)
+**Returns**: [Song
](#Song) - The parsed song
+**See**: https://peggyjs.org/documentation.html#using-the-parser | Param | Type | Default | Description | | --- | --- | --- | --- | -| [referenceKey] | [Key
](#Key) \| string
\| null
|
| the reference key. The key is required when converting a chord symbol
| - - +| chordSheet |string
| | the ChordPro chord sheet
| +| options |ChordProParserOptions
| | Parser options.
| +| options.softLineBreaks |ChordProParserOptions.softLineBreaks
| false
| If true, a backslash followed by * a space is treated as a soft line break
| -### chord.isNumeral() ⇒boolean
-Determines whether the chord is a numeral
+ -**Kind**: instance method of [Chord
](#Chord)
-
+## ~~ChordSheetParser~~
+***Deprecated***
-### chord.toString([configuration]) ⇒ string
-Converts the chord to a string, eg Esus4/G#
or 1sus4/#3
Parses a normal chord sheet
+ChordSheetParser is deprecated, please use ChordsOverWordsParser.
+ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks +support for many variations. Besides that, some chordpro feature have been ported back +to ChordsOverWordsParser, which adds some interesting functionality.
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: string
- the chord string
+**Kind**: global class -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [configuration] |Object
| {}
| options
| -| [configuration.useUnicodeModifier] |boolean
| false
| Whether or not to use unicode modifiers. This will make #
(sharp) look like ♯
and b
(flat) look like ♭
Song
](#Song)
-
+
-### chord.normalize([key], [options]) ⇒ [Chord
](#Chord)
-Normalizes the chord root and bass notes:
-Besides that it normalizes the suffix if normalizeSuffix
is true
.
-For example, sus2
becomes 2
, sus4
becomes sus
.
-All suffix normalizations can be found in src/normalize_mappings/suffix-mapping.txt
.
When the chord is minor, bass notes are normalized off of the relative major
-of the root note. For example, Em/A#
becomes Em/Bb
.
Instantiate a chord sheet parser +ChordSheetParser is deprecated, please use ChordsOverWordsParser.
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the normalized chord
| Param | Type | Default | Description | | --- | --- | --- | --- | -| [key] | [Key
](#Key) \| string
|
| the key to normalize to
| | [options] |Object
| {}
| options
| -| [options.normalizeSuffix] |boolean
| true
| whether to normalize the chord suffix after transposing
| - - - -### chord.useModifier(newModifier) ⇒ [Chord
](#Chord)
-Switches to the specified modifier
+| [options.preserveWhitespace] |boolean
| true
| whether to preserve trailing whitespace for chords
| -**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the new, changed chord
+ -| Param | Description | -| --- | --- | -| newModifier |the modifier to use: '#'
or 'b'
Song
](#Song)
+Parses a chord sheet into a song
- +**Kind**: instance method of [ChordSheetParser
](#ChordSheetParser)
+**Returns**: [Song
](#Song) - The parsed song
-### chord.transposeUp() ⇒ [Chord
](#Chord)
-Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E
+| Param | Type | Default | Description | +| --- | --- | --- | --- | +| chordSheet |string
| | The ChordPro chord sheet
| +| [options] |Object
| {}
| Optional parser options
| +| [options.song] | [Song
](#Song) |
| The [Song](#Song) to store the song data in
| -**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the new, transposed chord
- + -### chord.transposeDown() ⇒ [Chord
](#Chord)
-Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb
+## ChordsOverWordsParser +Parses a chords over words sheet into a song
+It support "regular" chord sheets:
+ Am C/G F C
+Let it be, let it be, let it be, let it be
+C G F C/E Dm C
+Whisper words of wisdom, let it be
+
+Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:
+{title: Let it be}
+{key: C}
+Chorus 1:
+ Am
+Let it be
+
+For convenience, you can leave out the brackets:
+title: Let it be
+Chorus 1:
+ Am
+Let it be
+
+You can even use a markdown style frontmatter separator to separate the header from the song:
+title: Let it be
+key: C
+---
+Chorus 1:
+ Am C/G F C
+Let it be, let it be, let it be, let it be
+C G F C/E Dm C
+Whisper words of wisdom, let it be
+
+ChordsOverWordsParser
is the better version of ChordSheetParser
, which is deprecated.
Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the new, transposed chord
- +**Kind**: global class -### chord.transpose(delta) ⇒ [Chord
](#Chord)
-Transposes the chord by the specified number of semitones
+* [ChordsOverWordsParser](#ChordsOverWordsParser) + * [.warnings](#ChordsOverWordsParser+warnings) : [Array.<ParserWarning>
](#ParserWarning)
+ * [.parse(chordSheet, options)](#ChordsOverWordsParser+parse) ⇒ [Song
](#Song)
-**Kind**: instance method of [Chord
](#Chord)
-**Returns**: [Chord
](#Chord) - the new, transposed chord
+ -| Param | Description | -| --- | --- | -| delta |de number of semitones
| +### chordsOverWordsParser.warnings : [Array.<ParserWarning>
](#ParserWarning)
+All warnings raised during parsing the chord sheet
- +**Kind**: instance property of [ChordsOverWordsParser
](#ChordsOverWordsParser)
+
-### Chord.parse(chordString) ⇒ [Chord
](#Chord) \| null
-Tries to parse a chord string into a chord
-Any leading or trailing whitespace is removed first, so a chord like \n E/G# \r
is valid.
Song
](#Song)
+Parses a chords over words sheet into a song
-**Kind**: static method of [Chord
](#Chord)
+**Kind**: instance method of [ChordsOverWordsParser
](#ChordsOverWordsParser)
+**Returns**: [Song
](#Song) - The parsed song
+**See**: https://peggyjs.org/documentation.html#using-the-parser -| Param | Description | -| --- | --- | -| chordString |the chord string, eg Esus4/G#
or 1sus4/#3
.
string
| | the chords over words sheet
| +| options |ChordsOverWordsParserOptions
| | Parser options.
| +| options.softLineBreaks |ChordsOverWordsParserOptions.softLineBreaks
| false
| If true, a backslash followed by a space is treated as a soft line break
| - + -## ChordSheetSerializer -Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)
+## ParserWarning +Represents a parser warning, currently only used by ChordProParser.
**Kind**: global class + -* [ChordSheetSerializer](#ChordSheetSerializer) - * [.serialize()](#ChordSheetSerializer+serialize) ⇒ - * [.deserialize(serializedSong)](#ChordSheetSerializer+deserialize) ⇒ [Song
](#Song)
-
-
-
-### chordSheetSerializer.serialize() ⇒
-Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc -Can be deserialized using [deserialize](deserialize)
- -**Kind**: instance method of [ChordSheetSerializer
](#ChordSheetSerializer)
-**Returns**: object A plain JS object containing all chord sheet data
- - -### chordSheetSerializer.deserialize(serializedSong) ⇒ [Song
](#Song)
-Deserializes a song that has been serialized using [serialize](serialize)
- -**Kind**: instance method of [ChordSheetSerializer
](#ChordSheetSerializer)
-**Returns**: [Song
](#Song) - The deserialized song
- -| Param | Type | Description | -| --- | --- | --- | -| serializedSong |object
| The serialized song
| +### parserWarning.toString() ⇒string
+Returns a stringified version of the warning
- +**Kind**: instance method of [ParserWarning
](#ParserWarning)
+**Returns**: string
- The string warning
+ -## Key -Represents a key, such as Eb (symbol), #3 (numeric) or VII (numeral).
-The only function considered public API is Key.distance
Parses an Ultimate Guitar chord sheet with metadata +Inherits from [ChordSheetParser](#ChordSheetParser)
**Kind**: global class - + -### Key.distance(oneKey, otherKey) ⇒number
-Calculates the distance in semitones between one key and another.
+### new UltimateGuitarParser([options]) +Instantiate a chord sheet parser
-**Kind**: static method of [Key
](#Key)
-**Returns**: number
- the distance in semitones
-| Param | Type | Description | -| --- | --- | --- | -| oneKey | [Key
](#Key) \| string
| the key
| -| otherKey | [Key
](#Key) \| string
| the other key
| +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [options] |Object
| {}
| options
| +| [options.preserveWhitespace] |boolean
| true
| whether to preserve trailing whitespace for chords
|