Skip to content

Commit 5154278

Browse files
bschilderclaude
andcommitted
Add _pkgdown.yml with echoverse dark theme and improve vignette
Add pkgdown site config with organized reference sections and echoverse dark theme. Add has_internet() guards to all vignette API calls so the vignette builds offline without errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6bbfca1 commit 5154278

2 files changed

Lines changed: 191 additions & 58 deletions

File tree

_pkgdown.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
url: https://rajlabmssm.github.io/echogithub/
2+
3+
template:
4+
bootstrap: 5
5+
bslib:
6+
bg: "#1a2744"
7+
fg: "#e8f4f4"
8+
primary: "#4ecdc4"
9+
secondary: "#3a8d8c"
10+
success: "#2ee8d6"
11+
info: "#5bc0be"
12+
code-bg: "#d6e4ee"
13+
code-color: "#1a2744"
14+
border-color: "#2a4060"
15+
link-color: "#4ecdc4"
16+
link-hover-color: "#2ee8d6"
17+
font-size-base: "1rem"
18+
includes:
19+
in_header: |
20+
<style>
21+
.navbar {
22+
background-color: #162038 !important;
23+
border-bottom: 2px solid #4ecdc4;
24+
}
25+
.navbar-brand, .nav-link { color: #e8f4f4 !important; }
26+
.nav-link:hover { color: #2ee8d6 !important; }
27+
.nav-link.active { color: #2ee8d6 !important; border-bottom: 2px solid #2ee8d6; }
28+
pre {
29+
background-color: #d6e4ee !important;
30+
color: #1a2744 !important;
31+
border: none !important;
32+
border-radius: 12px;
33+
margin: 0;
34+
padding: 0.8em 1em;
35+
}
36+
code { color: #1a6b68 !important; border: none !important; }
37+
pre code { color: #1a2744 !important; border: none !important; background: transparent !important; }
38+
pre code span { border: none !important; background: transparent !important; }
39+
.table { color: #e8f4f4 !important; }
40+
.table-striped > tbody > tr:nth-of-type(odd) > * {
41+
background-color: rgba(78, 205, 196, 0.05) !important;
42+
color: #e8f4f4 !important;
43+
}
44+
.table-striped > tbody > tr:nth-of-type(even) > * {
45+
background-color: transparent !important;
46+
color: #e8f4f4 !important;
47+
}
48+
.table > thead { border-bottom: 2px solid #4ecdc4; }
49+
h1, h2, h3, h4, h5, h6 { color: #4ecdc4 !important; }
50+
a { color: #5bc0be; }
51+
a:hover { color: #2ee8d6; }
52+
.card { background-color: #1e3050; border-color: #2a4060; }
53+
.footer { background-color: #162038 !important; border-top: 1px solid #2a4060; }
54+
.page-header { border-bottom: 2px solid #3a8d8c; }
55+
.sourceCode {
56+
background-color: #d6e4ee !important;
57+
border: 1px solid #3a8d8c;
58+
border-radius: 12px !important;
59+
overflow: hidden;
60+
}
61+
.sourceCode code span,
62+
.sourceCode code a {
63+
border: none !important;
64+
outline: none !important;
65+
box-shadow: none !important;
66+
background: transparent !important;
67+
}
68+
</style>
69+
70+
navbar:
71+
structure:
72+
left: [intro, reference, articles, news]
73+
right: [search, github]
74+
components:
75+
github:
76+
icon: fa-github
77+
href: https://github.com/RajLabMSSM/echogithub
78+
79+
articles:
80+
- title: Getting started
81+
contents:
82+
- echogithub
83+
84+
reference:
85+
- title: GitHub repository queries
86+
desc: Functions for querying GitHub repository metadata and content
87+
contents:
88+
- github_branches
89+
- github_code
90+
- github_commits
91+
- github_files
92+
- github_files_download
93+
- github_metadata
94+
- github_permissions
95+
- github_repositories
96+
- github_traffic
97+
- github_user_events
98+
- github_workflows
99+
- title: GitHub dependencies
100+
desc: Discover package dependencies and reverse dependencies
101+
contents:
102+
- github_dependencies
103+
- github_dependents
104+
- title: GitHub Pages
105+
desc: Query and scrape GitHub Pages websites
106+
contents:
107+
- github_pages
108+
- github_pages_files
109+
- github_pages_vignettes
110+
- title: DESCRIPTION file utilities
111+
desc: Extract and parse R package DESCRIPTION files
112+
contents:
113+
- description_extract
114+
- add_owner_repo
115+
- title: R package repositories
116+
desc: Query and compare R packages across CRAN, Bioconductor, and GitHub
117+
contents:
118+
- r_repos
119+
- r_repos_data
120+
- r_repos_downloads
121+
- r_repos_opts
122+
- r_repos_upset_queries

vignettes/echogithub.Rmd

Lines changed: 69 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
---
2-
title: "echogithub: Getting started"
3-
author: "<h4>Author: <i>Brian M. Schilder</i></h4>"
2+
title: "echogithub: Getting started"
3+
author: "<h4>Author: <i>Brian M. Schilder</i></h4>"
44
date: "<h4>Most recent update: <i>`r format( Sys.Date(), '%b-%d-%Y')`</i></h4>"
55
output:
66
BiocStyle::html_document
77
vignette: >
8-
%\VignetteIndexEntry{echogithub}
8+
%\VignetteIndexEntry{echogithub}
99
%\usepackage[utf8]{inputenc}
1010
%\VignetteEngine{knitr::rmarkdown}
1111
---
1212

13-
```{r setup}
13+
```{r setup, include = FALSE}
1414
library(echogithub)
15+
has_internet <- function() {
16+
tryCatch({
17+
con <- url("https://github.com", open = "r")
18+
close(con)
19+
TRUE
20+
}, error = function(e) FALSE)
21+
}
1522
```
1623

1724
# GitHub branches
@@ -20,7 +27,7 @@ library(echogithub)
2027

2128
Easily find all available branches for a given GitHub repo.
2229

23-
```{r}
30+
```{r, eval = has_internet()}
2431
branches <- echogithub::github_branches(owner = "RajLabMSSM",
2532
repo = "echolocatoR")
2633
print(branches)
@@ -29,35 +36,35 @@ print(branches)
2936
## Check
3037

3138
You can also check whether a particular branch exists.
32-
By default, `github_branches()` interprets "master" and "main" as synonymous and
39+
By default, `github_branches()` interprets "master" and "main" as synonymous and
3340
returns whichever one actually exists.
3441

35-
```{r}
36-
branches <- echogithub::github_branches(owner = "RajLabMSSM",
37-
repo = "echolocatoR",
42+
```{r, eval = has_internet()}
43+
branches <- echogithub::github_branches(owner = "RajLabMSSM",
44+
repo = "echolocatoR",
3845
branch = "main")
3946
print(branches)
4047
```
4148

4249

43-
# GitHub files
50+
# GitHub files
4451

4552
`github_files()` lets you easily:
46-
1. Search any GitHub repo
47-
(that you have access to) for files.
48-
2. Filter those files by a *regex* `query`,
49-
3. Download those files to your local compute
50-
(can increase `nThread` to speed up download via parallelization).
5153

52-
*NOTE*:
53-
To search your private repos, make sure you
54-
GitHub token is supplied to the `token` argument, or is saved as in your
55-
*~.Renviron* file, e.g.: `GITHUB_TOKEN=<token_here>`
54+
1. Search any GitHub repo (that you have access to) for files.
55+
2. Filter those files by a *regex* `query`.
56+
3. Download those files to your local computer
57+
(can increase `nThread` to speed up download via parallelisation).
58+
59+
*NOTE*:
60+
To search your private repos, make sure your
61+
GitHub token is supplied to the `token` argument, or is saved in your
62+
*~/.Renviron* file, e.g.: `GITHUB_TOKEN=<token_here>`
5663

57-
## Search / filter / downlaod
64+
## Search / filter / download
5865

59-
```{r}
60-
files <- echogithub::github_files(owner = "RajLabMSSM",
66+
```{r, eval = has_internet()}
67+
files <- echogithub::github_files(owner = "RajLabMSSM",
6168
repo = "Fine_Mapping_Shiny",
6269
query = ".md$",
6370
ignore.case = TRUE,
@@ -67,89 +74,93 @@ knitr::kable(utils::head(files))
6774

6875
# GitHub Pages
6976

70-
There are several functions to searching GitHub Pages websites associated
77+
There are several functions for searching GitHub Pages websites associated
7178
with specific GitHub repos.
7279

7380
## Find GitHub Pages URL
7481

82+
First, since not all GitHub repos use GitHub Pages, we should find out
83+
whether the one we are interested in exists.
7584

76-
First, since not all GitHub repo have use GitHub Pages, we should find out
77-
whether the one we're interested in exist.
78-
79-
```{r}
80-
ghpages_url <- echogithub::github_pages(owner ="RajLabMSSM",
85+
```{r, eval = has_internet()}
86+
ghpages_url <- echogithub::github_pages(owner = "RajLabMSSM",
8187
repo = "echolocatoR")
8288
print(ghpages_url)
8389
```
8490

85-
If it doesn't exist, the function will simply return `NULL` when you set
86-
`error=FALSE`.
91+
If it does not exist, the function will simply return `NULL` when you set
92+
`error = FALSE`.
8793

88-
```{r}
89-
ghpages_null <- echogithub::github_pages(owner ="RajLabMSSM",
90-
repo = "Fine_Mapping_Shiny",
91-
error = FALSE)
94+
```{r, eval = has_internet()}
95+
ghpages_null <- echogithub::github_pages(owner = "RajLabMSSM",
96+
repo = "Fine_Mapping_Shiny",
97+
error = FALSE)
9298
print(ghpages_null)
9399
```
94100

95101

96102
## Find vignettes
97103

98-
`github_pages_vignettes` allows you to easily gather all vignettes
104+
`github_pages_vignettes` allows you to easily gather all vignettes
99105
across multiple GitHub Pages websites at once.
100106

101107
### As `data.table`
102108

103-
```{r}
104-
vdt <- echogithub::github_pages_vignettes(owner = c("RajLabMSSM","neurogenomics"),
105-
repo = c("echodata","MungeSumstats"))
109+
```{r, eval = has_internet()}
110+
vdt <- echogithub::github_pages_vignettes(
111+
owner = c("RajLabMSSM", "neurogenomics"),
112+
repo = c("echodata", "MungeSumstats")
113+
)
106114
knitr::kable(utils::head(vdt))
107115
```
108116

109117
### As table of contents
110118

111-
You can also use the `as_toc=TRUE` argument to turn the vignettes `data.table`
112-
into an HTML Table of Contents (TOC).
119+
You can also use the `as_toc = TRUE` argument to turn the vignettes
120+
`data.table` into an HTML Table of Contents (TOC).
113121

114-
```{r, results='asis'}
115-
toc <- echogithub::github_pages_vignettes(owner = c("RajLabMSSM","neurogenomics"),
116-
repo = c("echodata","MungeSumstats"),
117-
as_toc = TRUE)
122+
```{r, results='asis', eval = has_internet()}
123+
toc <- echogithub::github_pages_vignettes(
124+
owner = c("RajLabMSSM", "neurogenomics"),
125+
repo = c("echodata", "MungeSumstats"),
126+
as_toc = TRUE
127+
)
118128
```
119129

120130
# *DESCRIPTION* files
121131

122-
*DESCRIPTION* files contains essential information about each R package.
123-
However finding and importing them is not always straightforward
132+
*DESCRIPTION* files contain essential information about each R package.
133+
However, finding and importing them is not always straightforward
124134
(e.g. when the package is not yet installed).
125-
`echogithub::description_extract` searches a variety of sources
126-
(e.g. local files, local installations, GitHub) to find the correct
135+
`echogithub::description_extract` searches a variety of sources
136+
(e.g. local files, local installations, GitHub) to find the correct
127137
*DESCRIPTION* file and import it into the easy-to-use `description` format.
128138

129139
It then parses it to extract the relevant information.
130-
140+
131141
## Find and extract
132142

133-
`description_extract` then takes that object and extracts and parses
143+
`description_extract` takes that object and extracts and parses
134144
just the fields you need, returning them as a named list.
135145

136-
```{r}
137-
res <- echogithub::description_extract(refs = c("RajLabMSSM/echolocatoR",
138-
"RajLabMSSM/echogithub",
139-
"RajLabMSSM/rworkflows"))
146+
```{r, eval = has_internet()}
147+
res <- echogithub::description_extract(
148+
refs = c("RajLabMSSM/echolocatoR",
149+
"RajLabMSSM/echogithub",
150+
"RajLabMSSM/rworkflows")
151+
)
140152
methods::show(res)
141153
```
142154

143155

144-
# Session Info
156+
# Session Info
145157

146-
<details>
158+
<details>
147159

148160
```{r Session Info}
149161
utils::sessionInfo()
150162
```
151163

152-
</details>
164+
</details>
153165

154166
<hr>
155-

0 commit comments

Comments
 (0)