mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Modified github.js to ensure __ isn't escaped at beginning of line
fixes #1791
This commit is contained in:
parent
bad2a307ae
commit
a79597d8b3
@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
//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) {
|
||||
text = text.replace(/(^(?! {4}|\t)(?!__)\w+_\w+_\w[\w_]*)/gm, function (x) {
|
||||
return x.replace(/_/gm, '\\_');
|
||||
});
|
||||
|
||||
|
@ -60,6 +60,18 @@ describe("Showdown client side converter", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("should not escape double underscores at the beginning of a line", function () {
|
||||
var testPhrases = [
|
||||
{input: "\n__test__\n", output: /^<p><strong>test<\/strong><\/p>$/}
|
||||
],
|
||||
processedMarkup;
|
||||
|
||||
testPhrases.forEach(function (testPhrase) {
|
||||
processedMarkup = converter.makeHtml(testPhrase.input);
|
||||
processedMarkup.should.match(testPhrase.output);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not treat pre blocks with pre-text differently", function () {
|
||||
var testPhrases = [
|
||||
{input: "<pre>\nthis is `a\\_test` and this\\_too and finally_this_is\n</pre>", output: /^<pre>\nthis is `a\\_test` and this\\_too and finally_this_is\n<\/pre>$/},
|
||||
|
Loading…
Reference in New Issue
Block a user