Skip to content

Commit

Permalink
Fix #676: Trying to keep current formatting intact
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Falkon committed Nov 27, 2021
1 parent 1df5aee commit 4eca609
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/mdh-html-to-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ MdhHtmlToText.prototype._preprocess = function() {
// to remain intact.
this.excludeTagBlocks('blockquote', true);

// Trying to keep current formatting intact (see issue #676)
for (const tagName of ['b','i','u','strike']) {
this.preprocessInfo.html = this.preprocessInfo.html.replace(
new RegExp(`<${tagName}>(.*?)<\/${tagName}>`, 'ig'),
`&lt;${tagName}&gt;$1&lt;\/${tagName}&gt;`
);
}

// Try to leave intact the line that Gmail adds that says:
// On such-a-date, such-a-person <email addy> wrote:
this.preprocessInfo.html = this.preprocessInfo.html.replace(
Expand Down

0 comments on commit 4eca609

Please sign in to comment.