diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index fc3e36b4..712feef7 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -24,16 +24,15 @@ export default class ExpensiMark { name: 'codeFence', // < is a backtick symbol we are matching on three of them before then after a new line character - regex: /```\n((?:(?!```)[\s\S])+)\n```/g, - + regex: /(```[\n]?)((?:(?![\n]?```)[\s\S])+)([\n]?```)/g, // We're using a function here to perform an additional replace on the content // inside the backticks because Android is not able to use
 tags and does
                 // not respect whitespace characters at all like HTML does. We do not want to mess
                 // with the new lines here since they need to be converted into 
. And we don't // want to do this anywhere else since that would break HTML. //   will create styling issues so use - replacement: (match, firstCapturedGroup) => { - const group = firstCapturedGroup.replace(/(?:(?![\n\r])\s)/g, ' '); + replacement: (match, _, secondCapturedGroup) => { + const group = secondCapturedGroup.replace(/(?:(?![\n\r])\s)/g, ' '); return `
${group}
`; }, },