feat: add maxBodyLength parameter to htmlToMarkdown#852
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
| if (parseBodyTag) { | ||
| generatedMarkdown = parseBodyTag[2]; | ||
| } | ||
| if (maxBodyLength > 0) { |
There was a problem hiding this comment.
Coming from Expensify/App#63711. We should have decoded the HTML first before truncation, otherwise decoding can fail if there isn't enough content to decode. More details here.
There was a problem hiding this comment.
Thanks for your feedback. The reason we truncated early was a compromise: there were serious performance issues with parsing into Markdown before truncation. I'll find a reference for you.
There was a problem hiding this comment.
Here is a more detailed comment on the performance issues around truncation before or after parsing: Expensify/App#57241 (comment)
There was a problem hiding this comment.
Here is a summary of our investigation: Expensify/App#57241 (comment) and the accepted proposal Expensify/App#57241 (comment)
Supporting change for fixing Expensify/App#57241.
Tests
__tests__/ExpensiMark-Markdown-test.jsmaxBodyLengthparameter.htmlToMarkdown()from Expensify repo and none will be affected by the additional parameter.QA