R Under development (unstable) (2023-12-02 r85657 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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 = markdown:::pkg_file('examples', 'render-options.R') + source(f, local = TRUE, echo = TRUE) + }) > library(markdown) > mkd <- c("# Header 1", "p1", "## Header 2", "p2") > cat(mark(mkd, options = "+number_sections"))

1. Header 1

p1

1.1 Header 2

p2

> cat(mark(mkd, options = "+number_sections+toc"))

1. Header 1

p1

1.1 Header 2

p2

> cat(mark("foo\nbar\n"))

foo bar

> cat(mark("foo\nbar\n", options = "hard_wrap"))

foo
bar

> mkd <- c("`$x$` is inline math $x$!", "", "Display style:", + "", "$$x + y$$", "", "\\begin{eqnarray}\na^{2}+b^{2} & = & c^{2}\\\\\n\\sin^{2}(x ..." ... [TRUNCATED] > cat(mark(mkd))

$x$ is inline math \(x\)!

Display style:

$$x + y$$

\begin{eqnarray} a^{2}+b^{2} & = & c^{2}\\ \sin^{2}(x)+\cos^{2}(x) & = & 1 \end{eqnarray}

> cat(mark(mkd, options = "-latex_math"))

$x$ is inline math $x$!

Display style:

$$x + y$$

\begin{eqnarray} a^{2}+b^{2} & = & c^{2}\ \sin^{2}(x)+\cos^{2}(x) & = & 1 \end{eqnarray}

> cat(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
> cat(mark("\nFirst Header | Second Header\n------------- | -------------\nContent Cell | Content Cell\nContent Cell | Content Cell\n", + opti .... [TRUNCATED]

First Header | Second Header ———–– | ———–– Content Cell | Content Cell Content Cell | Content Cell

> cat(mark("https://www.r-project.org/"))

https://www.r-project.org/

> cat(mark("https://www.r-project.org/", options = "-autolink"))

https://www.r-project.org/

> cat(mark("~~awesome~~"))

awesome

> cat(mark("~~awesome~~", options = "-strikethrough"))

~~awesome~~

> cat(mark("2^10^"))

210

> cat(mark("2^10^", options = "-superscript"))

2^10^

> cat(mark("H~2~O"))

H2O

> cat(mark("H~2~O", options = "-subscript"))

H~2~O

> cat(mark("```r\n1 + 1;\n```"))
1 + 1;
> cat(mark("```{.r}\n1 + 1;\n```"))
1 + 1;
> cat(mark("```{.r .js}\n1 + 1;\n```"))
1 + 1;
> cat(mark("```{.r .js #foo}\n1 + 1;\n```"))
1 + 1;
> cat(mark("```{.r .js #foo style=\"color:red;\"}\n1 + 1;\n```"))
1 + 1;
> cat(mark("````\n```{r, echo=TRUE}\n1 + 1;\n```\n````"))
```{r, echo=TRUE}
1 + 1;
```
> cat(mark("```{=html}\n

raw HTML

\n```"))

raw HTML

> cat(mark("```{=latex}\n

raw HTML

\n```")) > mkd = "\n[Hello](#)" > cat(mark(mkd))

Hello

> > proc.time() user system elapsed 0.21 0.07 0.29