Shiny nesting a link within a paragraph has unwanted whitespace

This has been resolved by a new feature, a parameter called .noWS. Quoting Carson Sievert:

you can now do:

p('This is my ', a(href = 'https://stackoverflow.com/', 'favorite link ever', .noWS = "outside"), '!', .noWS = c("after-begin", "before-end")) 

which yields

<p>This is my <a href="https://stackoverflow.com/">favorite link ever</a>!</p>

More information on the .noWS parameter can be found at the pull request.


I think you have to use paste. Otherwise nesting wouldn't work like expected.

div(p('hi'),p('what up'),p(HTML(paste0('This is my ',a(href = 'https://stackoverflow.com/', 'favorite link ever'),'!'))))

Result:

<div>
  <p>hi</p>
  <p>what up</p>
  <p>This is my <a href="https://stackoverflow.com/">favorite link ever</a>!</p>
</div>

You wouldn't want all those on the same line.

From the help: Named arguments become attributes, and positional arguments become children.

It would be more complexity to have positional arguments to also sometimes not be children; and probably wouldn't be as simple, flexible, and powerful as just constructing it yourself.