You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, there are no hooks in htmlToText that will let us skip the stripping. So we'll either have to:
modify the code directly
distasteful because it makes it harder to pull in any updates to the original project
in the preprocessing hook, replace trailing whitespace with placeholder tags, and then swap them back to the original whitespace in the tagreplacement hook
distasteful because it makes it harder to pull in any updates to the original project
If you were to make your change in a fork of js-htmltotext and pull upstream and push origin whenever it was updated, wouldn't that be a reasonably easy way of maintaining this change while simultaneously keeping it up-to-date?
This is assuming your change isn't accepted in a pull request back to the original project, of course.
(I know I'm late to the party, but I thought it might be worth still mentioning.)
According to the Markdown spec, two spaces at the end of a line indicates a hard line-break (
<br>
) should be inserted in the rendering.But the original-HTML-to-plaintext module we're using strips trailing whitespace. See:
https://github.com/adam-p/markdown-here/blob/master/src/common/jsHtmlToText.js#L72
Unfortunately, there are no hooks in
htmlToText
that will let us skip the stripping. So we'll either have to:preprocessing
hook, replace trailing whitespace with placeholder tags, and then swap them back to the original whitespace in thetagreplacement
hookOriginally discovered by a Reddit commenter.
The text was updated successfully, but these errors were encountered: