This vignette shows how the output looks like in HTML from
the other vignette markdown-examples.Rmd
, in which the
literal HTML code was shown.
library(litedown)
# toc example
mkd <- c("# Header 1", "p1", "## Header 2", "p2")
mark(mkd, options = "+number_sections")
p1
p2
p1
p2
foo bar
foo
bar
# latex math example
mkd <- c(
"`$x$` is inline math $x$!", "", "Display style:", "", "$$x + y$$", "",
"\\begin{align}
a^{2}+b^{2} & = c^{2}\\\\
\\sin^{2}(x)+\\cos^{2}(x) & = 1
\\end{align}"
)
mark(mkd)
x
is inline math
x!
Display style:
x + y
x
is inline math
x!
Display style:
x + y
+^{2}(x) & = 1 \end{align}
# table example
mark("
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
")
First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
a | b |
---|---|
A | 9 |
# no table
mark("
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
", options = '-table')
First Header | Second Header ———–– | ———–– Content Cell | Content Cell Content Cell | Content Cell
awesome
awesome
210
210
H2O
H2O
1 + 1;
1 + 1;
1 + 1;
1 + 1;
1 + 1;
A _code chunk_:
```{r, echo=TRUE}
1 + 1;
```
raw HTML
# filter out HTML tags
mkd = '<style>a {}</style><script type="text/javascript">console.log("No!");</script>\n[Hello](#)'
mark(mkd)
# tagfiler doesn't work: https://github.com/r-lib/commonmark/issues/15
# mark(mkd, options = "tagfilter")
1/2 (c)
½ ©
½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅐ ⅑ ⅒ © ® ™