mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
parent
d841e749f9
commit
e86958fdb7
1 changed files with 9 additions and 10 deletions
19
core/shared/vendor/showdown/extensions/github.js
vendored
19
core/shared/vendor/showdown/extensions/github.js
vendored
|
@ -20,6 +20,7 @@
|
|||
type : 'lang',
|
||||
filter : function (text) {
|
||||
var preExtractions = {},
|
||||
imageMarkdownRegex = /^(?:\{(.*?)\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim,
|
||||
hashID = 0;
|
||||
|
||||
function hashId() {
|
||||
|
@ -43,6 +44,14 @@
|
|||
return x.match(/\n{2}/) ? x : x.trim() + " \n";
|
||||
});
|
||||
|
||||
// better URL support, but no title support
|
||||
text = text.replace(imageMarkdownRegex, function (match, key, alt, src) {
|
||||
if (src) {
|
||||
return '<img src="' + src + '" alt="' + alt + '" />';
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
|
||||
text = text.replace(/\{gfm-js-extract-pre-([0-9]+)\}/gm, function (x, y) {
|
||||
return "\n\n" + preExtractions[y];
|
||||
|
@ -58,7 +67,6 @@
|
|||
filter : function (text) {
|
||||
var refExtractions = {},
|
||||
preExtractions = {},
|
||||
imageMarkdownRegex = /^(?:\{(.*?)\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim,
|
||||
hashID = 0;
|
||||
|
||||
function hashId() {
|
||||
|
@ -81,15 +89,6 @@
|
|||
return "{gfm-js-extract-ref-url-" + hash + "}";
|
||||
});
|
||||
|
||||
// better URL support, but no title support
|
||||
text = text.replace(imageMarkdownRegex, function (match, key, alt, src) {
|
||||
if (src) {
|
||||
return '<img src="' + src + '" alt="' + alt + '" />';
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
|
||||
// match a URL
|
||||
// adapted from https://gist.github.com/jorilallo/1283095#L158
|
||||
// and http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript
|
||||
|
|
Loading…
Add table
Reference in a new issue