diff --git a/src/markdown.ts b/src/markdown.ts index 0def7ca..3978227 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -76,6 +76,12 @@ const filters: Filters = { } return `\`${text}\`` }, + P(el) { + const pElement = document.createElement('p') + const text = el.textContent || '' + pElement.textContent = text.replace(/<(\/?)(pre|strong|weak|em)>/g, '\\<$1$2\\>') + return pElement + }, STRONG(el) { return `**${el.textContent || ''}**` }, diff --git a/test/test.js b/test/test.js index a101f44..050330b 100644 --- a/test/test.js +++ b/test/test.js @@ -102,6 +102,8 @@ describe('quote-selection', function () {
This should not appear as part of the quote.
This is beautifully formatted text that even has some
+inline code
.This is a simple p line
+some escaped html tags to ignore <pre> <strong> <weak> <em> </pre> </strong> </weak> </em>
Links and are preserved.
@@ -131,6 +133,10 @@ describe('quote-selection', function () { textarea.value.replace(/ +\n/g, '\n'), `> This is **beautifully** formatted _text_ that even has some \`inline code\`. > +> This is a simple p line +> +> some escaped html tags to ignore \\ \\ \\ \\ +> > \`\`\` > foo(true) > \`\`\`