0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Reverting some markdown fixes

issue #644

- this caused more trouble than it was worth, will revisit
This commit is contained in:
Hannah Wolfe 2013-09-12 21:49:29 +01:00
parent eb15a37850
commit 147951c59c

View file

@ -33,24 +33,11 @@
return "{gfm-js-extract-pre-" + hash + "}";
}, 'm');
// Replace showdown's implementation of bold
// <strong> must go first:
text = text.replace(/__([\s\S]+?)__(?!_)|\*\*([\s\S]+?)\*\*(?!\*)/g, function (match, m1, m2) {
return m1 ? "<strong>" + m1 + "</strong>" : "<strong>" + m2 + "</strong>";
});
//prevent foo_bar and foo_bar_baz from ending up with an italic word in the middle
text = text.replace(/(^(?! {4}|\t)\w+_\w+_\w[\w_]*)/gm, function (x) {
return x.replace(/_/gm, '\\_');
});
// Replace showdown's implementation of emphasis
// <em>
// requires a negative lookbehind for \n before the final * to prevent breaking lists
text = text.replace(/\b(\\)?_((?:__|[\s\S])+?)_\b|\*((?:\*\*|[\s\S])+?)(\n)?\*(?!\*)/g, function (match, escaped, m1, m2, newline) {
return escaped || newline ? match : m1 ? "<em>" + m1 + "</em>" : "<em>" + m2 + "</em>";
});
// in very clear cases, let newlines become <br /> tags
text = text.replace(/^[\w\<][^\n]*\n+/gm, function (x) {
return x.match(/\n{2}/) ? x : x.trim() + " \n";