Shiny 1.4.0 has been released! This release mostly focuses on under-the-hood fixes, but there are a few user-facing changes as well.
If you’ve written a Shiny app before, you’ve probably encountered errors like this:
div("Hello", "world!", ) #> Error in tag("div", list(...)) : argument is missing, with no default
This is due to a trailing comma in
div(). It’s very easy to accidentally add trailing commas when you’re writing and debugging a Shiny application.
In Shiny 1.4.0, you’ll no longer get this error – it will just work with trailing commas. This is true for
div() and all other HTML tag functions, like
p(), and so on.
The new version of Shiny also lets you control the whitespace between HTML tags. Previously, if there were two adjacent tags, like the two spans in
div(a("Visit this link", href="path/"), span(".")), whitespace would always be inserted between them, resulting in output that renders as “Visit this link .".
Here’s what the generated HTML looks like:
div(a("Visit this link", href = "path/"), span(".")) #> <div> #> <a href="path/">Visit this link</a> #> <span>.</span> #> </div>
Now, you can use the
.noWS parameter to remove the spacing between tags, so you can create output that renders as “Visit this link.":
div(a("Visit this link", href = "path/", .noWS = "after"), span(".")) #> <div> #> <a href="path/">Visit this link</a><span>.</span> #> </div>
.noWS parameter can take one or more other values to control whitespace in other ways:
"before"suppresses whitespace before the opening tag.
"after"suppresses whitespace after the closing tag.
"after-begin"suppresses whitespace between the opening tag and its first child. (In the example above, the
<span>tags are children of the
"after-begin"suppresses whitespace between the last child and the closing tag.
(These changes actually come from version 0.4.0 of the htmltools package, but most users will encounter these functions via Shiny, and the documentation in Shiny has been updated to reflect the changes.)
For the full set of changes in this version of Shiny, please see this page.
RStudio Package Manager 2022.07 now lets you publish your own binary packages, saving you time and frustration.
The Workbench homepage has been improved by offering more information at a glance, and by more accurately reporting information regarding session statuses.