File: tests.Rout.save

package info (click to toggle)
r-cran-markdown 1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 308 kB
  • sloc: javascript: 131; sh: 126; makefile: 9
file content (164 lines) | stat: -rw-r--r-- 4,537 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

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.

  Natural language support but running in an English locale

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"))
<h1 id="header-1"><span class="section-number">1.</span> Header 1</h1>
<p>p1</p>
<h2 id="header-2"><span class="section-number">1.1</span> Header 2</h2>
<p>p2</p>

> cat(mark(mkd, options = "+number_sections+toc"))
<div id="TOC">
<ul class="numbered">
<li><a href="#header-1"><span class="section-number">1.</span> Header 1</a>
<ul>
<li><a href="#header-2"><span class="section-number">1.1</span> Header 2</a></li>
</ul>
</li>
</ul>
</div>
<h1 id="header-1"><span class="section-number">1.</span> Header 1</h1>
<p>p1</p>
<h2 id="header-2"><span class="section-number">1.1</span> Header 2</h2>
<p>p2</p>

> cat(mark("foo\nbar\n"))
<p>foo
bar</p>

> cat(mark("foo\nbar\n", options = "hard_wrap"))
<p>foo<br />
bar</p>

> 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))
<p><code>$x$</code> is inline math \(x\)!</p>
<p>Display style:</p>
<p>$$x + y$$</p>
<p>\begin{eqnarray} a^{2}+b^{2} &amp; = &amp; c^{2}\\ \sin^{2}(x)+\cos^{2}(x) &amp; = &amp; 1 \end{eqnarray}</p>

> cat(mark(mkd, options = "-latex_math"))
<p><code>$x$</code> is inline math $x$!</p>
<p>Display style:</p>
<p>$$x + y$$</p>
<p>\begin{eqnarray}
a^{2}+b^{2} &amp; = &amp; c^{2}\
\sin^{2}(x)+\cos^{2}(x) &amp; = &amp; 1
\end{eqnarray}</p>

> cat(mark("\nFirst Header  | Second Header\n------------- | -------------\nContent Cell  | Content Cell\nContent Cell  | Content Cell\n"))
<table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
</tbody>
</table>

> cat(mark("\nFirst Header  | Second Header\n------------- | -------------\nContent Cell  | Content Cell\nContent Cell  | Content Cell\n", 
+     opti .... [TRUNCATED] 
<p>First Header  | Second Header
———–– | ———––
Content Cell  | Content Cell
Content Cell  | Content Cell</p>

> cat(mark("https://www.r-project.org/"))
<p><a href="https://www.r-project.org/">https://www.r-project.org/</a></p>

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

> cat(mark("~~awesome~~"))
<p><del>awesome</del></p>

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

> cat(mark("2^10^"))
<p>2<sup>10</sup></p>

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

> cat(mark("H~2~O"))
<p>H<sub>2</sub>O</p>

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

> cat(mark("```r\n1 + 1;\n```"))
<pre><code class="language-r">1 + 1;
</code></pre>

> cat(mark("```{.r}\n1 + 1;\n```"))
<pre><code class="language-r">1 + 1;
</code></pre>

> cat(mark("```{.r .js}\n1 + 1;\n```"))
<pre><code class="language-r js">1 + 1;
</code></pre>

> cat(mark("```{.r .js #foo}\n1 + 1;\n```"))
<pre><code class="language-r js" id="foo">1 + 1;
</code></pre>

> cat(mark("```{.r .js #foo style=\"color:red;\"}\n1 + 1;\n```"))
<pre><code class="language-r js" id="foo" style="color:red;">1 + 1;
</code></pre>

> cat(mark("````\n```{r, echo=TRUE}\n1 + 1;\n```\n````"))
<pre><code>```{r, echo=TRUE}
1 + 1;
```
</code></pre>

> cat(mark("```{=html}\n<p>raw HTML</p>\n```"))
<p>raw HTML</p>

> cat(mark("```{=latex}\n<p>raw HTML</p>\n```"))

> mkd = "<style>a {}</style><script type=\"text/javascript\">console.log(\"No!\");</script>\n[Hello](#)"

> cat(mark(mkd))
<style>a {}</style><script type="text/javascript">console.log("No!");</script>
<p><a href="#">Hello</a></p>
>