Skip to content
Draft

v3.0 #21

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
^vignettes/\.quarto$
^vignettes/*_files$
^LICENSE\.md$
^jarl\.toml$
^[.]?air[.]toml$
^\.vscode$
55 changes: 55 additions & 0 deletions .github/workflows/format-suggest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples

on:
# Using `pull_request_target` over `pull_request` for elevated `GITHUB_TOKEN`
# privileges, otherwise we can't set `pull-requests: write` when the pull
# request comes from a fork, which is our main use case (external contributors).
#
# `pull_request_target` runs in the context of the target branch (`main`, usually),
# rather than in the context of the pull request like `pull_request` does. Due
# to this, we must explicitly checkout `ref: ${{ github.event.pull_request.head.sha }}`.
# This is typically frowned upon by GitHub, as it exposes you to potentially running
# untrusted code in a context where you have elevated privileges, but they explicitly
# call out the use case of reformatting and committing back / commenting on the PR
# as a situation that should be safe (because we aren't actually running the untrusted
# code, we are just treating it as passive data).
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
pull_request_target:

name: format-suggest.yaml

jobs:
format-suggest:
name: format-suggest
runs-on: ubuntu-latest

permissions:
contents: read
checks: write
issues: write
pull-requests: write

steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
allow-unsafe-pr-checkout: true
persist-credentials: false

- name: Install
uses: posit-dev/setup-air@v1

- name: Jarl format
uses: etiennebacher/setup-jarl@v0.1.1
with:
args: "check --fix"

- name: Format
run: air format .

- name: Suggest
uses: reviewdog/action-suggester@v1
with:
level: error
fail_level: error
tool_name: air+jarl
23 changes: 22 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
NOT_CRAN: "true"
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v7

Expand Down Expand Up @@ -59,8 +60,11 @@ jobs:
Sys.setenv(PKGDOWN_DEV_MODE = "unreleased")
}

preview <- paste0(pkg$meta$url, "/pr/", pr_number)
cat(paste0("PREVIEW_URL=", preview, "\n"), file = Sys.getenv("GITHUB_ENV"), append = TRUE)

override <- list(
url = paste0(pkg$meta$url, "/pr/", pr_number),
url = preview,
template = list(
params = list(noindex = TRUE)
)
Expand Down Expand Up @@ -88,6 +92,16 @@ jobs:
clean: true
force: false

- name: Comment preview link
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
Preview: ${{ env.PREVIEW_URL }}
Built from ${{ github.event.pull_request.head.sha }}

- name: Deploy site
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -108,6 +122,7 @@ jobs:

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v7
Expand All @@ -130,3 +145,9 @@ jobs:
git commit -m "Remove pkgdown preview for PR #$PR_NUMBER"
git pull --rebase origin gh-pages
git push origin HEAD:gh-pages

- name: Hide preview comment
uses: marocchino/sticky-pull-request-comment@v2
with:
hide: true
hide_classify: OUTDATED
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"Posit.air-vscode",
"etiennebacher.jarl-vscode"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[r]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "Posit.air-vscode"
}
}
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: pkgdownconfig
Title: Stan pkgdown Website Styling
Version: 2.6.0
Version: 3.0.0
Authors@R:
person("Visruth", "Srimath Kandali", , "public@visruth.com", role = c("aut", "cre"),
person("Visruth", "Srimath Kandali", , "public@visruth.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0009-0005-9097-0688"))
Description: This package is a template package, built off of the Stan
Quarto styling. Exclusively for use styling `pkgdown` websites in the
Expand All @@ -13,9 +13,11 @@ URL: https://mc-stan.org/pkgdown-config,
BugReports: https://github.com/stan-dev/pkgdown-config/issues/
Suggests:
knitr,
quarto
quarto,
testthat (>= 3.0.0)
VignetteBuilder:
quarto
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Config/roxygen2/version: 8.1.0
Config/testthat/edition: 3
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(hello)
export(use_pkgdown_gha)
57 changes: 53 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
# pkgdownConfig 1.0.0:9000
# pkgdownconfig (development version)

Items for next release go here. This is just an example I'm not keeping a changelog. See release/commits.
# pkgdownconfig 3.0.0

# pkgdownConfig 1.0.0
* PR previews build only when the PR has the `build-website` label, and comment their URL and commit.
* PR previews are removed when the PR closes.
* The Other Packages menu includes `priorsense`.
* The navbar key `otherpkgs` is now `pkgs`. Update any navbar structure that uses it.
* MathJax is updated to 4.1.3.

- Theme released.
# pkgdownconfig 2.6.0

* Vignettes renamed to Articles.
* PR previews are built and deployed.

# pkgdownconfig 2.5.0

* Updated Roxygen, package and template versions.

# pkgdownconfig 2.4.0

* Fixed a pkgdown error for the logo.

# pkgdownconfig 2.3.0

* Updated MathJax to 4.0.0.

# pkgdownconfig 2.2.0

* Added the R Stan universe to the GitHub Action.
* The site branch is cleaned before deploying.

# pkgdownconfig 2.1.0

* Added GitHub links.
* Updated layout and the GitHub Action.

# pkgdownconfig 2.0.1

* Builds no longer wipe the site.
* Development mode is `auto`.

# pkgdownconfig 2.0.0

* Uses MathJax.
* Configuration uses the package name, not the repository name.
* Removed Twitter.

# pkgdownconfig 1.0.1

* Added a NEWS file.
* Scoped the muted text colour change.

# pkgdownconfig 1.0.0

* Theme released.
13 changes: 0 additions & 13 deletions R/Hello.R

This file was deleted.

17 changes: 17 additions & 0 deletions R/use_pkgdown_gha.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' Copy the Stan pkgdown GitHub Action
#'
#' Copies this package's `pkgdown.yaml` workflow into `.github/workflows`.
#'
#' @param pkg Path to the package.
#' @return The path of the workflow, invisibly.
#' @export
use_pkgdown_gha <- function(pkg = ".") {
path <- file.path(pkg, ".github", "workflows", "pkgdown.yaml")
dir.create(dirname(path), recursive = TRUE, showWarnings = FALSE)
file.copy(
system.file("workflows", "pkgdown.yaml", package = "pkgdownconfig"),
path,
overwrite = TRUE
)
invisible(path)
}
Empty file added air.toml
Empty file.
4 changes: 4 additions & 0 deletions inst/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ template:
# don't use mathml
math-rendering: mathjax

includes:
head: |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" referrerpolicy="no-referrer">

# syntax highlighting
theme: tango
theme-dark: nord
Expand Down
1 change: 1 addition & 0 deletions inst/pkgdown/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions inst/pkgdown/extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ pre {
color: var(--bs-body-color);
}

.navbar .navbar-brand img.stan-logo {
height: 25px !important;
width: auto;
.navbar .navbar-brand::before {
content: "";
display: inline-block;
width: 25px;
height: 25px;
margin-right: .4rem;
vertical-align: middle;
background: url("../../logo.svg") center / contain no-repeat;
}

.navbar .nav-text.text-danger {
Expand Down
Loading
Loading