R Under development (unstable) (2024-05-16 r86559 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > local({ + if (!file.exists(f <- '../inst/examples/render-options.R')) + f = litedown:::pkg_file('examples', 'render-options.R') + source(f, local = TRUE, echo = TRUE) + }) > library(litedown) > mkd <- c("# Header 1", "p1", "## Header 2", "p2") > mark(mkd, options = "+number_sections")
p1
p2
> mark(mkd, options = "+number_sections+toc")p1
p2
> mark("foo\nbar\n")foo bar
> mark("foo\nbar\n", options = "+hardbreaks")foo
bar
$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}
> mark("\nFirst Header | Second Header\n------------- | -------------\nContent Cell | Content Cell\nContent Cell | Content Cell\n")First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
a | b |
---|---|
A | 9 |
First Header | Second Header ———–– | ———–– Content Cell | Content Cell Content Cell | Content Cell
> mark("https://www.r-project.org/") > mark("https://www.r-project.org/", options = "-autolink")https://www.r-project.org/
> mark("~~awesome~~")awesome
~~awesome~~
> mark("2^10^")210
> mark("2^10^", options = "-superscript")2^10^
> mark("H~2~O")H2O
> mark("H~2~O", options = "-subscript")H~2~O
> 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;
```
> mark("```{=html}\nraw HTML
\n```")raw HTML
> mark("```{=latex}\nraw HTML
\n```") > mkd = "\n[Hello](#)" > mark(mkd) > > proc.time() user system elapsed 0.46 0.09 0.56