New compose_email implementation based on htmltools#178
Merged
Conversation
This also adds in the `content_width` variable.
Also: - reimplement default styles - change default width to 85% instead of ~600px - allow customization of font and content width - allow base template to be replaced with your own function - detect any <img src="file/data"> regardless of how it was generated, and use cid-style attachment (does not apply to web URLs)
Also `Content-Disposition: inline` fixes broken images on Gmail mobile app *when using non-gmail accounts*
- block_text() now defaults to align="left" - md() goes back to performing markdown rendering later, not at the time md() is called. I don't like this as much but it's necessary because blastula::md and gt::md need to stay compatible with each other due to masking. - Update test snapshots
0136397 to
c553f3b
Compare
- Image widths are now fluid in Outlook - No restriction on number/type of blocks
- Bump up content area's padding from 8px to 12px - The first and last articles in a block_articles now sit flush with the left and right edges of regular content
This was
linked to
issues
Apr 22, 2020
Closed
The new_releases_email.R test case was failing with a stack overflow. It was due to backtracking across the contents of a tag body, which in this case was dozens of megabytes (the image was 24MB(!!) to start with, then base64-encoded!). Dropping the (/?) from the pattern allows us to change the preceding *? to *+ (possessive quantifier, TIL!), which avoids backtracking.
Seems to be a bug in PCRE-based regex engine. Could not switch to stringi/stringr, as there isn't a function that can return positions of capturing groups. By simplifying the pattern in replace_attr I was able to switch to perl=FALSE, seems to be OK.
rich-iannone
requested changes
Apr 22, 2020
Member
rich-iannone
left a comment
There was a problem hiding this comment.
Thanks again for the large amount of work done here. I have only small editorial comments, nothing that important but you can commit directly if you agree.
Comment on lines
+59
to
+74
| article( | ||
| image = "https://i.imgur.com/5aJawp2.jpg", | ||
| title = "Hyperreal", | ||
| content = | ||
| "By utilizing a combination of the Hyperreal headset (and | ||
| additional measures), one can have the sensation of being | ||
| truly immersed in the VR world." | ||
| ), | ||
| article( | ||
| image = "https://i.imgur.com/5aJawp2.jpg", | ||
| title = "Hyperreal", | ||
| content = | ||
| "By utilizing a combination of the Hyperreal headset (and | ||
| additional measures), one can have the sensation of being | ||
| truly immersed in the VR world." | ||
| ), |
Member
There was a problem hiding this comment.
These are duplicated articles.
Co-Authored-By: Richard Iannone <riannone@me.com>
Closed
rich-iannone
approved these changes
Apr 23, 2020
This was referenced Apr 25, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing notes
There are a bunch of examples in tests/manual_tests you can use.
You can preview in your local email client (e.g. outlook) using a function like this:
Call
local_preview(eml), whereemlis the return value fromcompose_emailorrender_email. (You can continue to justprint(eml)to view it in a web browser)