diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 02fc9183..ba7c1000 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -16,7 +16,7 @@ test('Test bold markdown replacement', () => { // Words wrapped in * successfully replaced with test('Test quote markdown replacement', () => { const quoteTestStartString = '>This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```'; - const quoteTestReplacedString = '
This is a quote that started on a new line.
Here is a >quote that did not
here is a codefenced quote
>it should not be quoted
'; + const quoteTestReplacedString = '
This is a quote that started on a new line.
Here is a >quote that did not
here is a codefenced quote
>it should not be quoted
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); @@ -81,7 +81,7 @@ test('Test HTML encoded strings', () => { // New lines characters \\n were successfully replaced with
test('Test newline markdown replacement', () => { const newLineTestStartString = 'This sentence has a newline \n Yep just had one \n Oh there it is another one'; - const newLineReplacedString = 'This sentence has a newline
Yep just had one
Oh there it is another one'; + const newLineReplacedString = 'This sentence has a newline
Yep just had one
Oh there it is another one'; expect(parser.replace(newLineTestStartString)).toBe(newLineReplacedString); }); @@ -107,16 +107,16 @@ test('Test code fencing', () => { test('Test code fencing with spaces and new lines', () => { let codeFenceExample = '```\nconst javaScript = \'javaScript\'\n const php = \'php\'\n```'; - expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); + expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); codeFenceExample = '```const javaScript = \'javaScript\'\n const php = \'php\'\n```'; - expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); + expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); codeFenceExample = '```\nconst javaScript = \'javaScript\'\n const php = \'php\'```'; - expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); + expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); codeFenceExample = '```const javaScript = \'javaScript\'\n const php = \'php\'```'; - expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); + expect(parser.replace(codeFenceExample)).toBe('
const javaScript = 'javaScript'
const php = 'php'
'); }); test('Test inline code blocks', () => { @@ -156,7 +156,7 @@ test('Test code fencing with ExpensiMark syntax inside', () => { test('Test combination replacements', () => { const urlTestStartString = 'Here is a _combination test_ that sees if ~https://www.example.com~ https://otherexample.com links get rendered first followed by *other markup* or if _*two work together*_ as well. This sentence also has a newline \n Yep just had one.'; const urlTestReplacedString = '<em>Here</em> is a combination test that <marquee>sees</marquee> if https://www.example.com https://otherexample.com links get rendered first followed by other markup or if two work together as well. This sentence also has a newline
Yep just had one.'; + + ' target="_blank" rel="noreferrer noopener">https://otherexample.com links get rendered first followed by other markup or if two work together as well. This sentence also has a newline
Yep just had one.'; expect(parser.replace(urlTestStartString)).toBe(urlTestReplacedString); }); @@ -378,7 +378,7 @@ test('Test markdown and url links with inconsistent starting and closing parens' test('Test quotes markdown replacement with text matching inside and outside codefence without spaces', () => { const testString = 'The next line should be quoted\n>Hello,I’mtext\n```\nThe next line should not be quoted\n>Hello,I’mtext\nsince its inside a codefence```'; - const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext
since its inside a codefence
'; + const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext
since its inside a codefence
'; expect(parser.replace(testString)).toBe(resultString); }); @@ -386,7 +386,7 @@ test('Test quotes markdown replacement with text matching inside and outside cod test('Test quotes markdown replacement with text matching inside and outside codefence at the same line', () => { const testString = 'The next line should be quoted\n>Hello,I’mtext\nThe next line should not be quoted\n```>Hello,I’mtext```\nsince its inside a codefence'; - const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext

since its inside a codefence'; + const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext

since its inside a codefence'; expect(parser.replace(testString)).toBe(resultString); }); @@ -394,7 +394,7 @@ test('Test quotes markdown replacement with text matching inside and outside cod test('Test quotes markdown replacement with text matching inside and outside codefence at the end of the text', () => { const testString = 'The next line should be quoted\n>Hello,I’mtext\nThe next line should not be quoted\n```>Hello,I’mtext```'; - const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext
'; + const resultString = 'The next line should be quoted
Hello,I’mtext
The next line should not be quoted
>Hello,I’mtext
'; expect(parser.replace(testString)).toBe(resultString); }); @@ -402,7 +402,7 @@ test('Test quotes markdown replacement with text matching inside and outside cod test('Test quotes markdown replacement with text matching inside and outside codefence with quotes at the end of the text', () => { const testString = 'The next line should be quoted\n```>Hello,I’mtext```\nThe next line should not be quoted\n>Hello,I’mtext'; - const resultString = 'The next line should be quoted
>Hello,I’mtext

The next line should not be quoted
Hello,I’mtext
'; + const resultString = 'The next line should be quoted
>Hello,I’mtext

The next line should not be quoted
Hello,I’mtext
'; expect(parser.replace(testString)).toBe(resultString); }); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index e831e1bc..4721dddf 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -160,7 +160,7 @@ export default class ExpensiMark { { name: 'newline', regex: /\n/g, - replacement: '
', + replacement: '
', }, ];