diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index fbe18fb6..7f0ba5a3 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -309,6 +309,11 @@ test('Test inline code blocks inside ExpensiMark', () => { expect(parser.replace(testString)).toBe(resultString); }); +test('Test inline code blocks with two backticks', () => { + const testString = '``JavaScript``'; + expect(parser.replace(testString)).toBe('`JavaScript`'); +}); + test('Test code fencing with ExpensiMark syntax inside', () => { let codeFenceExample = '```\nThis is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)\n```'; expect(parser.replace(codeFenceExample)).toBe('
This is how you can write ~strikethrough~, *bold*, _italics_, and [links](https://www.expensify.com)
'); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index 644b108b..d9fbc560 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -47,7 +47,7 @@ export default class ExpensiMark { // Use the url escaped version of a backtick (`) symbol. Mobile platforms do not support lookbehinds, // so capture the first and third group and place them in the replacement. - regex: /(\B|_|)`(.*?\S.*?)`(\B|_|)(?![^<]*<\/pre>)/g, + regex: /(\B|_|)`(.*?\S.*?)`(\B|_|)(?!`|[^<]*<\/pre>)/g, replacement: '$1$2$3', },