
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
chord-parser-render
Advanced tools
Parse and render guitar chords contained within a string of tablature
Utility for parsing and rendering guitar chords contained within an any string. Note, that chord must be in
square brackets and starts with capital letter, e.g. [Am7].
Brackets will be removed after processing a chord.
The most common use case is to wrap all chords found within a song in an anchor tag
so that their finger chart can be presented in a tooltip.
In progress.
npm install chord-parser-render
or if using on the web, clone repo, run grunt copy and grab the dist/chord-parser-render.min.js file.
var input = '\
[Em] [D] [Dsus4] [Cadd9] \
So close no matter how far. \
[Em] [D] [Cadd9]\
Couldn’t be much more from the heart. \
[Em] [D] [Dsus4] [Cadd9]\
Forever trusting who we are \
[G] [B7] [Em] \
And nothing else matters.';
// Import
var ChordParser = require('chord-parser-render');
// Create a new ChordParser object with the input string
var tabs = new ChordParser(input);
// Wrap chords found in the string (Em, D, etc.) with an anchor tag
var wrappedTab = tabs.wrap(function(chord) {
return '<a href="">' + chord + '</a>';
});
// Return an array of unique chords found in the string
var uniques = tabs.unique(); // => ["B7", "Cadd9", "D", "Dsus4", "Em", "G"];
Create a new chord parsing object passing in a string of guitar tabs/chords to parse:
var parser = new ChordParser(inputString);
wrap(replacerFn);This method calls the function replacerFn for each chord it finds in the
input string, passing in the chord in as its only argument. Your wrapper function should
return a string to replace the chord with. A modified version of the input
string with the transposed replacements is returned.
new ChordParser('[Ab] [C#]').wrap(function(chord) {
return '<a>' + chord + '</a>';
});
// Return value: '<a>Ab</a> <a>C#</a>'
all()Return a sorted array of all chords found in the input string.
new ChordParser('[Ab] [C#] [B] [C#]').all();
// Return value: ['Ab', 'B', 'C#', 'C#']
unique()Return a sorted array of unique chords found in the input string.
new ChordParser('[Ab] [C#] [B] [C#]').unique();
// Return value: ['Ab', 'B', 'C#']
Run npm test.
MIT.
FAQs
Parse and render guitar chords contained within a string of tablature
We found that chord-parser-render demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.