diff --git a/ghost/admin/assets/vendor/showdown/extensions/ghostdown.js b/ghost/admin/assets/vendor/showdown/extensions/ghostdown.js index dbe0cee149..edc996b9a2 100644 --- a/ghost/admin/assets/vendor/showdown/extensions/ghostdown.js +++ b/ghost/admin/assets/vendor/showdown/extensions/ghostdown.js @@ -1,14 +1,15 @@ (function () { - var ghostdown = function (converter) { + var ghostdown = function () { return [ - // [image] syntax + // ![] image syntax { type: 'lang', - filter: function (source) { - return source.replace(/\n?!(?:image)?\[([^\n\]]*)\](?:\(([^\n\)]*)\))?/gi, function (match, alt, src) { + filter: function (text) { + return text.replace(/\n?!\[([^\n\]]*)\](?:\(([^\n\)]*)\))?/gi, function (match, alt, src) { var result = ""; - if (src !== "http://") { + /* regex from isURL in node-validator. Yum! */ + if (src && src.match(/^(?!mailto:)(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[0-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))|localhost)(?::\d{2,5})?(?:\/[^\s]*)?$/i)) { result = ''; } return '
' + result + diff --git a/ghost/admin/markdown-actions.js b/ghost/admin/markdown-actions.js index f76d826983..256ab5700c 100644 --- a/ghost/admin/markdown-actions.js +++ b/ghost/admin/markdown-actions.js @@ -140,7 +140,7 @@ strike: "~~$1~~", code: "`$1`", link: "[$1](http://)", - image: "!image[$1](http://)", + image: "![$1](http://)", blockquote: "> $1" } }; diff --git a/ghost/admin/tpl/modals/markdown.hbs b/ghost/admin/tpl/modals/markdown.hbs index 612e4039df..8533660988 100644 --- a/ghost/admin/tpl/modals/markdown.hbs +++ b/ghost/admin/tpl/modals/markdown.hbs @@ -34,7 +34,7 @@ Image - !image[image](http://) + ![alt](http://) Ctrl + Shift + I