Blame view
resources/js/showdown-extensions/newline.js
601 Bytes
e77200db5 Initial commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/** * Showdown extension for GFM newlines. * * In very clear cases, let newlines become <br/> tags. * * This implementation is adopted from showdown-ghost. * */ (function () { function newline() { return [{ type: 'lang', filter: function(text) { return text.replace(/^( *(\d+\. {1,4}|[\w\<\'\">\-*+])[^ ]*) {1}(?! | *\d+\. {1,4}| *[-*+] +|#|$)/gm, function(e) { return e.trim() + " "; }) } }]; } if (window && window.showdown) { window.showdown.extensions.newline = newline; } if (typeof module !== 'undefined') { module.exports = newline; } })(); |