The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
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
mark(mkd, options = "+number_sections+toc")
p1
p2
# hard_wrap example
mark("foo\nbar\n")
foo bar
mark("foo\nbar\n", options = "+hardbreaks")
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$$
\begin{align} a^{2}+b^{2} & = c^{2}\\ \sin^{2}(x)+\cos^{2}(x) & = 1 \end{align}
mark(mkd, options = "-latex_math")
$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}
# 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 |
# caption
mark("
| a | b |
|---|--:|
| A | 9 |
Table: A table _caption_.
")
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
# autolink example
mark("https://www.r-project.org/")
mark("https://www.r-project.org/", options = "-autolink")
https://www.r-project.org/
# strikethrough example
mark("~~awesome~~")
awesome
mark("~~awesome~~", options = "-strikethrough")
~~awesome~~
# superscript and subscript examples
mark("2^10^")
210
mark("2^10^", options = "-superscript")
210
mark("H~2~O")
H2O
mark("H~2~O", options = "-subscript")
H2O
# code blocks
mark('```r\n1 + 1;\n```')
1 + 1;
mark('```{.r}\n1 + 1;\n```')
1 + 1;
mark('```{.r .js}\n1 + 1;\n```')
1 + 1;
mark('```{.r .js #foo}\n1 + 1;\n```')
1 + 1;
mark('```{.r .js #foo style="background:lime;"}\n1 + 1;\n```')
1 + 1;
mark('````\nA _code chunk_:\n\n```{r, echo=TRUE}\n1 + 1;\n```\n````')
A _code chunk_:
```{r, echo=TRUE}
1 + 1;
```
# raw blocks
mark('```{=html}\n<p>raw HTML</p>\n```')
raw HTML
mark('```{=latex}\n<p>raw HTML</p>\n```')
# 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")
# smartypants example
cat(mark("1/2 (c)"))
1/2 (c)
cat(mark("1/2 (c)", options = "+smartypants"))
½ ©
mkd <- paste(names(litedown:::pants), collapse = ' ')
cat(mark(mkd, options = "+smartypants"))
½ ⅓ ⅔ ¼ ¾ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅐ ⅑ ⅒ © ® ™
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.