gadenbuie / tweetrmd

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

Embedding tweets in reactable #7

Open gadenbuie opened 4 years ago

gadenbuie commented 4 years ago

(and other places where the tweets are visible later in the render process)

x <- tibble::tibble(name = "Tom", handle = "@thomas_mock", tweet = "https://twitter.com/thomas_mock/status/1294670115590545408")

tbl <- htmltools::tagList(
  tweetrmd:::html_dependency_twitter(),
  reactable::reactable(
    data = x,
    # groupBy = "handle",
    columns = list(
      tweet = reactable::colDef(
        cell = function(tweet_url) {
          tweet_embed(tweet_url, omit_script = FALSE)
        },
        html = TRUE
      )
    )
  )
)

htmltools::browsable(tbl)
gadenbuie commented 4 years ago

thanks @jthomasmock for bringing this up!

gadenbuie commented 4 years ago

relevant docs: https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/scripting-loading-and-initialization

gadenbuie commented 4 years ago

https://gist.github.com/gadenbuie/1e47c9b50ccbaea95cc9e00b39ec3f27