diff --git a/__tests__/ExpensiMark-Markdown-test.js b/__tests__/ExpensiMark-Markdown-test.js index 09c68462..8e0b834f 100644 --- a/__tests__/ExpensiMark-Markdown-test.js +++ b/__tests__/ExpensiMark-Markdown-test.js @@ -679,3 +679,14 @@ test('Test blockquote linebreak handling with text, block and inline elements', const testStringSurroundedByBlockElementHeading = '
quote a
quote b
quote c
textcode
codetext'; + expect(parser.htmlToMarkdown(testString)).toBe('```\ncode\n```\ntext'); + + testString = '
Code snippet\n
'; + expect(parser.htmlToMarkdown(testString)).toBe('test heading\n```\nCode snippet\n```\n> [link](https://www.example.com)') +}); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index d5fd18b4..644b108b 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -256,6 +256,11 @@ export default class ExpensiMark { ), replacement: '', }, + { + name: 'nested', + regex: /<(pre)(?:"[^"]*"|'[^']*'|[^'">])*><(div|code)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\2><\/pre>/gi, + replacement: '
$3' + }, { name: 'newline',