showdown-ghost-footnotes
Advanced tools
Comparing version
{ | ||
"name": "showdown-footnotes", | ||
"name": "showdown-ghost-footnotes", | ||
"description": "Add footnotes support to showdown", | ||
@@ -7,3 +7,3 @@ "homepage": "https://github.com/tivie/showdown-footnotes", | ||
"authors": [ | ||
"Estev�o Soares dos Santos (https://github.com/tivie)" | ||
"Estevão Soares dos Santos (https://github.com/tivie)" | ||
], | ||
@@ -18,6 +18,6 @@ "keywords": [ | ||
"type": "git", | ||
"url": "https://github.com/tivie/showdown-footnotes.git", | ||
"web": "https://github.com/tivie/showdown-footnotes" | ||
"url": "https://github.com/tivie/showdown-ghost-footnotes.git", | ||
"web": "https://github.com/tivie/showdown-ghost-footnotes" | ||
}, | ||
"main": ["src/showdown-footnotes.js"], | ||
"main": ["src/showdown-ghost-footnotes.js"], | ||
"ignore": [ | ||
@@ -24,0 +24,0 @@ "test/", |
{ | ||
"name": "showdown-ghost-footnotes", | ||
"version": "0.0.3", | ||
"description": "Add footnotes support to showdown", | ||
"version": "0.0.4", | ||
"description": "Add footnotes support to showdown in ghost", | ||
"keywords": [ | ||
@@ -27,4 +27,4 @@ "markdown", | ||
"js-beautify": "^1.5.10", | ||
"showdown": "^1.6.1" | ||
"showdown": "^1.6.2" | ||
} | ||
} |
@@ -89,4 +89,4 @@ /** | ||
// we will use our own escape character (trema) to prevent clash with showdown main | ||
text = text.replace(/¨/g, '¨T'); | ||
// we will use our own escape character § to prevent clash with showdown main | ||
text = text.replace(/§/g, '§T'); | ||
@@ -97,3 +97,3 @@ // first strip the reference footnotes | ||
text = text.replace(/^ {0,3}\[\^(.+?)]:[ \t]?([\s\S]+?)(?=~0|\n {0,2}[\S]|^ {0,3}\[\^(.+?)]:)/gm, function(wholematch, ref, content) { | ||
ref = ref.replace(/\$/g, '¨D'); | ||
ref = ref.replace(/\$/g, '§D'); | ||
footRefs[ref] = { | ||
@@ -104,3 +104,3 @@ content: content, | ||
// we return a marker so we can bail with orphaned references | ||
return '¨F¨R¨S' + ref + '¨F¨R¨E'; | ||
return '§F§R§S' + ref + '§F§R§E'; | ||
}); | ||
@@ -112,9 +112,9 @@ | ||
//escape dollar signs (magic in regex) | ||
ref = ref.replace(/\$/g, '¨D'); | ||
ref = ref.replace(/\$/g, '§D'); | ||
footMarkers.push(ref); | ||
// we now return only the ref, but double escaped with "¨F¨M" to prevent it being | ||
// we now return only the ref, but double escaped with "§F§M" to prevent it being | ||
// parsed as a link in case of something like this: | ||
// [^1] (http://some.url.that.is.inside.parenthesis.com) | ||
return "¨F¨M¨S" + ref + "¨F¨M¨E"; | ||
return "§F§M§S" + ref + "§F§M§E"; | ||
}); | ||
@@ -142,3 +142,3 @@ | ||
if (footRefs.hasOwnProperty(uRef)) { | ||
text = text.replace(new RegExp('¨F¨R¨S' + uRef + '¨F¨R¨E', 'g'), footRefs[uRef].wMatch); | ||
text = text.replace(new RegExp('§F§R§S' + uRef + '§F§R§E', 'g'), footRefs[uRef].wMatch); | ||
} | ||
@@ -149,8 +149,8 @@ } | ||
for (var y = 0; y < orphanedRefs.length; ++y) { | ||
var oRef = orphanedRefs[y].replace(/¨D/g, '$'); | ||
text = text.replace(new RegExp('¨F¨M¨S' + oRef + '¨F¨M¨E', 'g'), '[^' + oRef + ']'); | ||
var oRef = orphanedRefs[y].replace(/§D/g, '$'); | ||
text = text.replace(new RegExp('§F§M§S' + oRef + '§F§M§E', 'g'), '[^' + oRef + ']'); | ||
} | ||
// lastly we strip the footnote tokens | ||
text = text.replace(/¨F¨R¨S(.+?)¨F¨R¨E/g, ''); | ||
text = text.replace(/§F§R§S(.+?)§F§R§E/g, ''); | ||
@@ -188,3 +188,3 @@ // and remove the sentinel | ||
// replace markers with markup | ||
text = text.replace('¨F¨M¨S' + ref + '¨F¨M¨E', mk); | ||
text = text.replace('§F§M§S' + ref + '§F§M§E', mk); | ||
@@ -204,4 +204,4 @@ // parse footnotes md | ||
// lastly we unescape trema | ||
text = text.replace(/¨T/g, '¨'); | ||
// lastly we unescape § | ||
text = text.replace(/§T/g, '§'); | ||
@@ -208,0 +208,0 @@ // Add footnotes to the end of file and return |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52244
31.16%25
8.7%0
-100%