79 lines
78 KiB
HTML
Raw Permalink Normal View History

2025-01-12 00:52:51 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>R Markdown with the Docco Linear Style</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
<link rel="stylesheet" href="https://ashkenas.com/docco/resources/linear/public/stylesheets/normalize.css">
<link rel="stylesheet" href="https://ashkenas.com/docco/resources/linear/docco.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rstudio/markdown/inst/resources/prism-xcode.css">
<style type="text/css">.container{width:auto;max-width:920px;}.page{width:auto;max-width:800px;}.page pre{width:100%;max-width:768px;}pre, code{font-size:90%;}</style>
</head>
<body>
<div class="container"><div class="page">
<div class="frontmatter">
<div class="title"><h1>R Markdown with the Docco Linear Style</h1></div>
<div class="author"><h2></h2></div>
<div class="date"><h3></h3></div>
</div>
<div class="body">
<!--
%\VignetteEngine{knitr::docco_linear_notangle}
%\VignetteIndexEntry{R Markdown with the Docco Linear Style}
-->
<p>This is an example of Markdown vignettes using the <a href="http://ashkenas.com/docco/">Docco style</a>.</p>
<h2 id="docco">Docco</h2>
<p>To use the Docco style for Markdown vignettes in an R package, you need to</p>
<ul>
<li>add <code>*.Rmd</code> files under the <code>vignettes</code> directory</li>
<li>add <code>Suggests: knitr</code> and <code>VignetteBuilder: knitr</code> to the <code>DESCRIPTION</code> file</li>
<li>specify the vignette engine <code>\VignetteEngine{knitr::docco_linear}</code> in the <code>Rmd</code> files (inside HTML comments)</li>
</ul>
<p>After building and installing the package, you can view vignettes via</p>
<pre><code class="language-r">browseVignettes(package = 'Your_Package')
</code></pre>
<h2 id="examples">Examples</h2>
<p>Below are some code chunks as examples.</p>
<pre><code class="language-r">cat('_hello_ **markdown**!', '\n')
</code></pre>
<p><em>hello</em> <strong>markdown</strong>!</p>
<p>Normally you do not need any chunk options.</p>
<pre><code class="language-r">1+1
</code></pre>
<pre><code>## [1] 2
</code></pre>
<pre><code class="language-r">10:1
</code></pre>
<pre><code>## [1] 10 9 8 7 6 5 4 3 2 1
</code></pre>
<pre><code class="language-r">rnorm(5)^2
</code></pre>
<pre><code>## [1] 0.02793 0.06013 2.93306 0.58198 0.04078
</code></pre>
<pre><code class="language-r">strsplit('hello, markdown vignettes', '')
</code></pre>
<pre><code>## [[1]]
## [1] &quot;h&quot; &quot;e&quot; &quot;l&quot; &quot;l&quot; &quot;o&quot; &quot;,&quot; &quot; &quot; &quot;m&quot; &quot;a&quot; &quot;r&quot; &quot;k&quot; &quot;d&quot; &quot;o&quot; &quot;w&quot; &quot;n&quot; &quot; &quot; &quot;v&quot; &quot;i&quot; &quot;g&quot;
## [20] &quot;n&quot; &quot;e&quot; &quot;t&quot; &quot;t&quot; &quot;e&quot; &quot;s&quot;
</code></pre>
<p>Feel free to draw beautiful plots and write math \(P(X&gt;x)=\alpha/2\).</p>
<pre><code class="language-r">n=300; set.seed(123)
par(mar=c(4,4,.1,.1))
plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray')
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfgAAAH4CAYAAACmKP9/AAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuP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X777YO8feITn1gV1hgsJE8mB5IDW+NAAvzWWJ0V7SsHZNWf5G1YbcH74Ac/eHX3u9999e53v7t5u145VjwdLPf73e9+x9qbUfY5vycHjgMHEuCPwyhmH5IDa3IAyHu73OWXX97sVmdjH54MHg5/XPl+JyUHkgOHw4EE+MMZq2xpcmCjHCgBfaMVZeHJgeTAVjiQSXZbYXNWkhxIDiQHkgPJge1yIAF+u/zO2pIDyYHkQHIgObAVDiTAb4XNWUlyIDmQHEgOJAe2y4EE+O3yO2tLDiQHkgPJgeTAVjiQAL8VNmclyYHkQHIgOZAc2C4HEuC3y++sLTmQHEgOJAeSA1vh
<h2 id="how-does-it-work">How does it work</h2>
<p>Custom CSS and JS files are passed to <code>markdown::mark_html()</code> to style the HTML page:</p>
<pre><code class="language-r">knitr:::docco_linear
</code></pre>
<p>That is it.</p>
</div>
<div class="fleur">h</div></div></div>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/combine/npm/katex/dist/katex.min.js,npm/katex/dist/contrib/auto-render.min.js,npm/@xiee/utils/js/render-katex.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils/js/center-img.min.js" defer></script>
</body>
</html>