show_markdown | R Documentation |
Render markdown to html in rstudio viewer or default browser.
show_markdown(
...,
use_viewer = !is.null(getOption("viewer")),
markArgs = list()
)
... |
one or more character strings |
use_viewer |
logical; if |
markArgs |
a list of addition arguments passed to
|
The html code (invisibly) as a character string.
show_html
, show_math
## Not run:
library('markdown')
## separate strings of markdown
show_markdown('## this is a header','here is some *plain* text ',
'<font color=red>ahhh</font>')
## or as a single character string
mkd <- "
1. Here is some markdown I want to test
2. This is a list
+ a sub-point
+ another sub-point
```
This text is displayed verbatim / preformatted
```
and this text will be formatted using r syntax
```r
mean(1:5)
```
And now I will make a table:
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
## ta-daaa!
> here's a picture with a [hyperlink](www.google.com):
<div align=center>
<a href='http://xkcd.com/710/'>
<img src='http://imgs.xkcd.com/comics/collatz_conjecture.png'
style='display: block; margin: auto;' />
</a>
</div>
"
show_markdown(mkd)
## the default stylesheet is
getOption('markdown.HTML.stylesheet')
## apply another style sheet by setting the option or passing
## arguments directly to markdown::markdownToHTML
## here are four css files in this package
list.files(system.file(package = 'rawr', 'styles'))
kcss <- system.file(package = 'rawr', 'styles', 'knitr.css')
gcss <- system.file(package = 'rawr', 'styles', 'github.css')
## file.show(gcss)
show_markdown(mkd, markArgs = list(stylesheet = gcss))
show_markdown(mkd, markArgs = list(stylesheet = kcss),
use_viewer = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.