mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #1821 from schneidmaster/fix-1791
Modified github.js to ensure __ is not escaped at the beginning of a line
This commit is contained in:
commit
3937c1bf0e
2 changed files with 13 additions and 1 deletions
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
|
|
||||||
//prevent foo_bar and foo_bar_baz from ending up with an italic word in the middle
|
//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, '\\_');
|
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 () {
|
it("should not treat pre blocks with pre-text differently", function () {
|
||||||
var testPhrases = [
|
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>$/},
|
{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…
Add table
Reference in a new issue