Skip to content

Commit 916d01b

Browse files
committed
test
1 parent cb0ee64 commit 916d01b

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Automatically link references and articles in an HTML page
2+
3+
**deprecated**
4+
5+
`intro`: “Get Started�, which links to a vignette or article with
6+
the same name as the package[¹](#fn1).
7+
8+
``` yaml
9+
template:
10+
includes:
11+
before_title: <!-- inserted before the package title in the header ->
12+
before_navbar: <!-- inserted before the navbar links -->
13+
after_navbar: <!-- inserted after the navbar links -->
14+
```
15+
16+
These inclusions will appear on all screen sizes, and will not be
17+
collapsed into the the navbar drop down.
18+
19+
You can also customise the colour scheme of the navbar by using the
20+
`type` and `bg` parameters. See above for details.
21+
22+
``` r
23+
usethis::create_package("~/desktop/testpackage")
24+
# ... edit files ...
25+
pkgdown::build_site(tmp, new_process = FALSE, preview = FALSE)
26+
```
27+
28+
Once you have built a minimal package that recreates the error, create a
29+
GitHub repository from the package (e.g. with
30+
[`usethis::use_git()`](https://usethis.r-lib.org/reference/use_git.html) +
31+
[`usethis::use_github()`](https://usethis.r-lib.org/reference/use_github.html)),
32+
and file an issue with a link to the repository.
33+
34+
------------------------------------------------------------------------
35+
36+
1. Note that dots (`.`) in the package name need to be replaced by
37+
hyphens (`-`) in the vignette filename to be recognized as the
38+
intro. That means for a package `foo.bar` the intro needs to be
39+
named `foo-bar.Rmd`.

tests/testthat/assets/llm.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<main id="main" class="col-md-9"><div class="page-header">
3+
<img src="../logo.png" class="logo" alt=""><h1>Automatically link references and articles in an HTML page</h1>
4+
<small class="dont-index">Source: <a href="https://github.com/r-lib/pkgdown/blob/main/R/autolink_html.R" class="external-link"><code>R/autolink_html.R</code></a></small>
5+
<div class="d-none name"><code>autolink_html.Rd</code></div>
6+
</div>
7+
8+
<p><a href="https://lifecycle.r-lib.org/articles/stages.html#deprecated" class="external-link"><img src="figures/lifecycle-deprecated.svg" alt="[Deprecated]"></a></p>
9+
10+
11+
<code>intro</code>: “Get Started”, which links to a vignette or
12+
article with the same name as the package<a class="footnote-ref" tabindex="0" data-bs-toggle="popover" data-bs-content="&lt;p&gt;Note that dots (&lt;code&gt;.&lt;/code&gt;) in the package name need
13+
to be replaced by hyphens (&lt;code&gt;-&lt;/code&gt;) in the vignette filename to
14+
be recognized as the intro. That means for a package
15+
&lt;code&gt;foo.bar&lt;/code&gt; the intro needs to be named
16+
&lt;code&gt;foo-bar.Rmd&lt;/code&gt;.&lt;/p&gt;"><sup>1</sup></a>.
17+
18+
<div class="sourceCode" id="cb23"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb23-1"><a href="#cb23-1" tabindex="-1"></a><span class="fu">template</span><span class="kw">:</span></span>
19+
<span id="cb23-2"><a href="#cb23-2" tabindex="-1"></a><span class="at"> </span><span class="fu">includes</span><span class="kw">:</span></span>
20+
<span id="cb23-3"><a href="#cb23-3" tabindex="-1"></a><span class="fu"> before_title</span><span class="kw">: </span><span class="at">&lt;!-- inserted before the package title in the header -</span><span class="ch">&gt;</span></span>
21+
<span id="cb23-4"><a href="#cb23-4" tabindex="-1"></a><span class="fu"> before_navbar</span><span class="kw">: </span><span class="at">&lt;!-- inserted before the navbar links --</span><span class="ch">&gt;</span></span>
22+
<span id="cb23-5"><a href="#cb23-5" tabindex="-1"></a><span class="fu"> after_navbar</span><span class="kw">: </span><span class="at">&lt;!-- inserted after the navbar links --</span><span class="ch">&gt;</span></span></code></pre></div>
23+
<p>These inclusions will appear on all screen sizes, and will not be
24+
collapsed into the the navbar drop down.</p>
25+
<p>You can also customise the colour scheme of the navbar by using the
26+
<code>type</code> and <code>bg</code> parameters. See above for
27+
details.</p>
28+
29+
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
30+
<code class="sourceCode R"><span><span class="fu">usethis</span><span class="fu">::</span><span class="fu"><a href="https://usethis.r-lib.org/reference/create_package.html" class="external-link">create_package</a></span><span class="op">(</span><span class="st">"~/desktop/testpackage"</span><span class="op">)</span></span>
31+
<span><span class="co"># ... edit files ...</span></span>
32+
<span><span class="fu">pkgdown</span><span class="fu">::</span><span class="fu"><a href="reference/build_site.html">build_site</a></span><span class="op">(</span><span class="va">tmp</span>, new_process <span class="op">=</span> <span class="cn">FALSE</span>, preview <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
33+
<p>Once you have built a minimal package that recreates the error, create a GitHub repository from the package (e.g. with <code><a href="https://usethis.r-lib.org/reference/use_git.html" class="external-link">usethis::use_git()</a></code> + <code><a href="https://usethis.r-lib.org/reference/use_github.html" class="external-link">usethis::use_github()</a></code>), and file an issue with a link to the repository.</p>
34+
</div>
35+
<div class
36+
37+
</main>

tests/testthat/test-build-llm.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ test_that("build_llm_docs() works", {
1515
index_md <- path(pkg$dst_path, "index.md")
1616
expect_snapshot_file(index_md)
1717
})
18+
19+
test_that("convert_md() works", {
20+
skip_if_no_pandoc()
21+
pkg <- local_pkgdown_site()
22+
23+
dir <- withr::local_tempdir()
24+
pkg$dst_path <- dir
25+
26+
html <- test_path("assets", "llm.html")
27+
fs::file_copy(html, path(dir, "llm.html"))
28+
29+
expect_snapshot_file(convert_md("llm.html", pkg))
30+
})

0 commit comments

Comments
 (0)