title: How to print htmlwidgets to HTML result inside a function?
body: <pre><code>---
  title: "Untitled"
  output: html_document
  ---
  
  ```{r setup, include=FALSE}
  library(DT)
  xsx = function(){
    print(getOption("viewer"))
    print(datatable(data.frame(d =1)))
    1
  }
  xsx()
  ```
  </code></pre>
  
  <p>Inside xsx() function, DT widgets will not be rendered in HTML result. How can I get widgets print inside a function?</p>