gadenbuie / tweetrmd

Embed Tweets in R Markdown
Other
102 stars 13 forks source link

The tweet_embed function is not rendering properly to HTML in RMarkdown #5

Closed dsquintana closed 4 years ago

dsquintana commented 4 years ago

When using the tweet_embed function when creating a RMarkdown document, this does not render properly to HTML, either in RStudio or in a browser (I tested Chrome and Safari).

Here is the HTML output.

__Dropbox_UiO_Projects_Test_R_markdown_test_html

Here is a reprex of a command that does not render to HTML properly in a RMarkdown document.

tweetrmd::tweet_embed("https://twitter.com/dsquintana/status/1275705042385940480?s=20")

This same command renders the tweet properly in Chrome when running this in the console (i.e., not a RMarkdown document). This is the output that I expect from the RMarkdown document

localhost_27607_session_viewhtml5448568d5104_index_html

gadenbuie commented 4 years ago

Thanks for reporting this and for bringing up your use case. I've fixed the particular issue you ran into and I'm pretty certain it will now work in bookdown, but please let me know if you run into any issues.

Thanks to this discussion, I also added include_tweet(). It works like knitr::include_graphics(), and will automatically choose to embed the HTML or a screenshot based on the output format. I also used your tweet in the README, I hope that's okay 😄