markdown-it-chords
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
/*! markdown-it-chords 1.0.2 @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownItChords = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/*! markdown-it-chords 1.0.3 @license MIT */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.markdownItChords = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
'use strict' | ||
@@ -8,3 +8,3 @@ | ||
const CHORD_REGEX = /^\[([A-G])([♭♯]*)(M|Δ|[Mm]aj|m|[Mm]in|‑|[Dd]im|°|ø|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(1?[\d])?((?:[\(\/,]?(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(\/[A-G][♭♯]*)?(\|[XxOo\d,\(\)]{3,})?\]/ | ||
const EXTENDED_REGEX = /(?:[\(\/,1]*(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[02-9]+\)?)*/ | ||
const EXTENDED_REGEX = /(?:[\(\/,1]*(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*/ | ||
const DIAGRAM_REGEX = /^\[(?:[XxOo\d,\(\)]{3,})\]/ | ||
@@ -11,0 +11,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownItChords=e()}}(function(){return function(){return function e(r,t,n){function o(p,u){if(!t[p]){if(!r[p]){var c="function"==typeof require&&require;if(!u&&c)return c(p,!0);if(s)return s(p,!0);var i=new Error("Cannot find module '"+p+"'");throw i.code="MODULE_NOT_FOUND",i}var a=t[p]={exports:{}};r[p][0].call(a.exports,function(e){return o(r[p][1][e]||e)},a,a.exports,e,r,t,n)}return t[p].exports}for(var s="function"==typeof require&&require,p=0;p<n.length;p++)o(n[p]);return o}}()({1:[function(e,r,t){"use strict";const n=/^\[[A-G][b#\u266d\u266f]*(?:M|\u0394|[Mm]aj|m|[Mm]in|-|\u2013|[Dd]im|o|\xb0|\xf8|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(?:1?[\d])?(?:(?:[\(\/,]?(?:[-\u2013+\u0394ob#\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(?:\/[A-G][b#\u266d\u266f]*)?(?:\|[XxOo\d,\(\)]{3,})?\]/,o=/^\[([A-G])([\u266d\u266f]*)(M|\u0394|[Mm]aj|m|[Mm]in|\u2011|[Dd]im|\xb0|\xf8|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(1?[\d])?((?:[\(\/,]?(?:[\u2011+\u0394\xb0\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(\/[A-G][\u266d\u266f]*)?(\|[XxOo\d,\(\)]{3,})?\]/,s=/(?:[\(\/,1]*(?:[\u2011+\u0394\xb0\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[02-9]+\)?)*/,p=/^\[(?:[XxOo\d,\(\)]{3,})\]/;function u(e,r){let t,u,i,a,h,d,f,l,m=e.pos;return 91===e.src.charCodeAt(m)&&(!!(t=e.src.slice(m)).length&&((u=t.match(n))?(a=((i=u[0].split("|"))[0]+"]").replace(/b/g,"\u266d").replace(/#/g,"\u266f").replace(/o/g,"\xb0").replace(/[-\u2013]/g,"\u2011").match(o),h=c(i[1])):h=c((u=t.match(p)||[""])[0]),!(!a&&!h)&&(l=a?"chord":"chord diagram",r||((f=e.push("chord_open","span",1)).attrs=[["class",l]],(f=e.push("chord_inner_open","span",1)).attrs=[["class","inner"]],a&&(d=!!a[5]&&a[5].match(s),(f=e.push("chord_i_open","i",1)).attrs=[["class","name"]],(f=e.push("text","",0)).content=a[1],a[2]&&(f.content+=a[2]),"\xf8"===a[3]?(e.push("sup_open","sup",1),(f=e.push("text","",0)).content="\xf8",e.push("sup_close","sup",-1)):a[3]&&(f.content+=a[3]),a[4]&&(e.push("sup_open","sup",1),(f=e.push("text","",0)).content=a[4],e.push("sup_close","sup",-1)),d&&d.forEach(r=>{e.push("sup_open","sup",1),(f=e.push("text","",0)).content=r,e.push("sup_close","sup",-1)}),a[6]&&((f=e.push("text","",0)).content=a[6]),f=e.push("chord_i_close","i",-1)),h&&h.length&&((f=e.push("chord_i_open","i",1)).attrs=[["class","diagram"]],h.forEach(r=>{(f=e.push("text","",0)).content=r,e.push("br","br",0)}),f=e.push("chord_i_close","i",-1)),f=e.push("chord_inner_close","span",-1),f=e.push("chord_close","span",-1)),e.pos+=u[0].length,!0)))}function c(e){if(!e)return!1;const r=String.fromCharCode(8214),t=String.fromCharCode(822),n=String.fromCharCode(821),o=String.fromCharCode(160),s=String.fromCharCode(9679),p=String.fromCharCode(9675);let u,c,i,a,h=99,d=0,f=n,l=[];return e=e.replace(/[\[\]|]/g,"").replace(/[Oo]/g,"0"),(e=/,/.test(e)?e.split(","):e.match(/\(?[XxOo\d]\)?/g)).reverse(),e=e.map(e=>((u=parseInt(e.replace(/[\(\)]/g,""),10))&&u<h&&(h=u),u&&u>d&&(d=u),i=isNaN(u)?"x":u?/\(/.test(e)?p:s:o,{fret:u||0,char:i})),d<=4&&(h=1),d-h<2&&d++,h>1&&(l.push(`${o}${h}fr`),f=t),e.forEach((n,s)=>{c=s&&s<e.length-1,a="x"===n.char?"x":o,a+=`${c?r:o}${f}`;for(let e=h;e<=d;e++)a+=e===n.fret?n.char:`${o}${t}`,a+=`${c?"|":o}${t}`;l.push(`${a}`)}),l}r.exports=function(e){e.inline.ruler.push("chords",u)}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).markdownItChords=e()}}(function(){return function(){return function e(r,t,n){function o(p,u){if(!t[p]){if(!r[p]){var c="function"==typeof require&&require;if(!u&&c)return c(p,!0);if(s)return s(p,!0);var i=new Error("Cannot find module '"+p+"'");throw i.code="MODULE_NOT_FOUND",i}var a=t[p]={exports:{}};r[p][0].call(a.exports,function(e){return o(r[p][1][e]||e)},a,a.exports,e,r,t,n)}return t[p].exports}for(var s="function"==typeof require&&require,p=0;p<n.length;p++)o(n[p]);return o}}()({1:[function(e,r,t){"use strict";const n=/^\[[A-G][b#\u266d\u266f]*(?:M|\u0394|[Mm]aj|m|[Mm]in|-|\u2013|[Dd]im|o|\xb0|\xf8|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(?:1?[\d])?(?:(?:[\(\/,]?(?:[-\u2013+\u0394ob#\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(?:\/[A-G][b#\u266d\u266f]*)?(?:\|[XxOo\d,\(\)]{3,})?\]/,o=/^\[([A-G])([\u266d\u266f]*)(M|\u0394|[Mm]aj|m|[Mm]in|\u2011|[Dd]im|\xb0|\xf8|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(1?[\d])?((?:[\(\/,]?(?:[\u2011+\u0394\xb0\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(\/[A-G][\u266d\u266f]*)?(\|[XxOo\d,\(\)]{3,})?\]/,s=/(?:[\(\/,1]*(?:[\u2011+\u0394\xb0\u266d\u266f]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*/,p=/^\[(?:[XxOo\d,\(\)]{3,})\]/;function u(e,r){let t,u,i,a,h,d,f,l,m=e.pos;return 91===e.src.charCodeAt(m)&&(!!(t=e.src.slice(m)).length&&((u=t.match(n))?(a=((i=u[0].split("|"))[0]+"]").replace(/b/g,"\u266d").replace(/#/g,"\u266f").replace(/o/g,"\xb0").replace(/[-\u2013]/g,"\u2011").match(o),h=c(i[1])):h=c((u=t.match(p)||[""])[0]),!(!a&&!h)&&(l=a?"chord":"chord diagram",r||((f=e.push("chord_open","span",1)).attrs=[["class",l]],(f=e.push("chord_inner_open","span",1)).attrs=[["class","inner"]],a&&(d=!!a[5]&&a[5].match(s),(f=e.push("chord_i_open","i",1)).attrs=[["class","name"]],(f=e.push("text","",0)).content=a[1],a[2]&&(f.content+=a[2]),"\xf8"===a[3]?(e.push("sup_open","sup",1),(f=e.push("text","",0)).content="\xf8",e.push("sup_close","sup",-1)):a[3]&&(f.content+=a[3]),a[4]&&(e.push("sup_open","sup",1),(f=e.push("text","",0)).content=a[4],e.push("sup_close","sup",-1)),d&&d.forEach(r=>{e.push("sup_open","sup",1),(f=e.push("text","",0)).content=r,e.push("sup_close","sup",-1)}),a[6]&&((f=e.push("text","",0)).content=a[6]),f=e.push("chord_i_close","i",-1)),h&&h.length&&((f=e.push("chord_i_open","i",1)).attrs=[["class","diagram"]],h.forEach(r=>{(f=e.push("text","",0)).content=r,e.push("br","br",0)}),f=e.push("chord_i_close","i",-1)),f=e.push("chord_inner_close","span",-1),f=e.push("chord_close","span",-1)),e.pos+=u[0].length,!0)))}function c(e){if(!e)return!1;const r=String.fromCharCode(8214),t=String.fromCharCode(822),n=String.fromCharCode(821),o=String.fromCharCode(160),s=String.fromCharCode(9679),p=String.fromCharCode(9675);let u,c,i,a,h=99,d=0,f=n,l=[];return e=e.replace(/[\[\]|]/g,"").replace(/[Oo]/g,"0"),(e=/,/.test(e)?e.split(","):e.match(/\(?[XxOo\d]\)?/g)).reverse(),e=e.map(e=>((u=parseInt(e.replace(/[\(\)]/g,""),10))&&u<h&&(h=u),u&&u>d&&(d=u),i=isNaN(u)?"x":u?/\(/.test(e)?p:s:o,{fret:u||0,char:i})),d<=4&&(h=1),d-h<2&&d++,h>1&&(l.push(`${o}${h}fr`),f=t),e.forEach((n,s)=>{c=s&&s<e.length-1,a="x"===n.char?"x":o,a+=`${c?r:o}${f}`;for(let e=h;e<=d;e++)a+=e===n.fret?n.char:`${o}${t}`,a+=`${c?"|":o}${t}`;l.push(`${a}`)}),l}r.exports=function(e){e.inline.ruler.push("chords",u)}},{}]},{},[1])(1)}); |
@@ -7,3 +7,3 @@ 'use strict' | ||
const CHORD_REGEX = /^\[([A-G])([♭♯]*)(M|Δ|[Mm]aj|m|[Mm]in|‑|[Dd]im|°|ø|[Aa]ug|\+|[Ss]usp?|[Aa]dd)?(1?[\d])?((?:[\(\/,]?(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*)?(\/[A-G][♭♯]*)?(\|[XxOo\d,\(\)]{3,})?\]/ | ||
const EXTENDED_REGEX = /(?:[\(\/,1]*(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[02-9]+\)?)*/ | ||
const EXTENDED_REGEX = /(?:[\(\/,1]*(?:[‑+Δ°♭♯]|[Mm]aj|[Mm]in|[Ss]usp?)?[0-9]+\)?)*/ | ||
const DIAGRAM_REGEX = /^\[(?:[XxOo\d,\(\)]{3,})\]/ | ||
@@ -10,0 +10,0 @@ |
{ | ||
"name": "markdown-it-chords", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Add support for lyric sheet chords in markdown.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,3 @@ #!/usr/bin/env node | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/11.0.0/markdown-it.min.js" integrity="sha256-3mv+NUxFuBg26MtcnuN2X37WUxuGunWCCiG2YCSBjNc=" crossorigin="anonymous"></script> | ||
<script src="../dist/markdown-it-chords.min.js"></script> | ||
<script src="markdown-it-chords.min.js"></script> | ||
<script> | ||
@@ -44,2 +44,5 @@ const md = window.markdownit().use(window.markdownItChords) | ||
${styles} | ||
.chord { | ||
font-family: Didot, "Helvetica Neue", serif; | ||
} | ||
body { | ||
@@ -46,0 +49,0 @@ padding: 50px; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49897
10
520
2
7