Skip to content

Commit 4eca609

Browse files
author
Gal Falkon
committed
Fix #676: Trying to keep current formatting intact
1 parent 1df5aee commit 4eca609

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/common/mdh-html-to-text.js

+8
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ MdhHtmlToText.prototype._preprocess = function() {
105105
// to remain intact.
106106
this.excludeTagBlocks('blockquote', true);
107107

108+
// Trying to keep current formatting intact (see issue #676)
109+
for (const tagName of ['b','i','u','strike']) {
110+
this.preprocessInfo.html = this.preprocessInfo.html.replace(
111+
new RegExp(`<${tagName}>(.*?)<\/${tagName}>`, 'ig'),
112+
`&lt;${tagName}&gt;$1&lt;\/${tagName}&gt;`
113+
);
114+
}
115+
108116
// Try to leave intact the line that Gmail adds that says:
109117
// On such-a-date, such-a-person <email addy> wrote:
110118
this.preprocessInfo.html = this.preprocessInfo.html.replace(

0 commit comments

Comments
 (0)