Skip to content

Commit

Permalink
support rmarkdown; fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali committed Apr 18, 2023
1 parent b82b303 commit cab0ecf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinybrowser
Title: Find Out Information About a User's Web Browser in 'Shiny'
Version: 1.0.0.9000
Version: 1.0.0.9001
Authors@R: person("Dean", "Attali",
email = "[email protected]",
role = c("aut", "cre"),
Expand All @@ -20,5 +20,5 @@ Suggests:
shinydisconnect
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased version

- {shinybrowser} now works in Rmarkdown documents (#7)
- Replace `addResourcePath()` with `htmlDependency()` which is more robust

# shinybrowser 1.0.0 (2022-05-11)
Expand Down
14 changes: 8 additions & 6 deletions R/detect.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@
#' }
#' @export
detect <- function() {
htmltools::htmlDependency(
name = "shinybrowser-binding",
version = as.character(utils::packageVersion("shinybrowser")),
package = "shinybrowser",
src = "assets/shinybrowser",
script = "shinybrowser.js"
shiny::tagList(
htmltools::htmlDependency(
name = "shinybrowser-binding",
version = as.character(utils::packageVersion("shinybrowser")),
package = "shinybrowser",
src = "assets/shinybrowser",
script = "shinybrowser.js"
)
)
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ List of 5

Note that {shinybrowser} also returns the "user_agent" string, which you can access using `get_user_agent()`, but you generally shouldn't need to use this string.

You can also use {shinybrowser} in Rmarkdown documents, as long as they use `runtime: shiny`.

<h2 id="convenience">Convenience checker functions</h2>

{shinybrowser} has a few convenience functions for very common checks. For example, there are many browsers, but often Internet Explorer is the problematic one. If you want to check for it you can use `is_browser_ie()`, which is just a shorthand for `get_browser() == "Internet Explorer"`. There are a few other similar `is_*` functions that can be used as a shortcut.
Expand Down

0 comments on commit cab0ecf

Please sign in to comment.