Repository navigation
Quarto vignettes: biocstyle-html / biocstyle-pdf formats and engines (#121) - #132
Merged
Merged
Conversation
Quarto extension bundled at inst/quarto/_extensions/biocstyle that gives Quarto documents the features of BiocStyle::html_document and BiocStyle::pdf_document (#121): - biocstyle-html: SCSS theme with the Bioconductor palette (BiocBlue #1a81c2 headings and links, green #87b13f title; palette from bioconductor.css and #114), floating left TOC, numbered sections, footnotes in the margin, title block with authors, affiliations, emails, date, abstract and package line. - biocstyle-pdf: loads the same Bioconductor.sty as pdf_document via include-in-header (copied next to the document with format-resources), with title/before-body/toc partials for the authblk author block, abstract and \packageVersion line. - biocstyle.lua: 'package:' field -> 'Package X version' (version from the 'package-version' metadata set by the vignette engines, falling back to ../DESCRIPTION when previewing), fig-small / fig-wide figure classes, authblk commands for PDF. - biocstyle-post.lua: wrap HTML tables in a horizontal-scroll container; drop control spaces in inline code for Bioconductor.sty's soul. Bioconductor.sty is a copy of inst/resources/tex/Bioconductor.sty so the extension is self-contained; a unit test keeps the two identical. Co-Authored-By: Claude <noreply@anthropic.com>
Register two vignette engines for .qmd files in .onLoad. At weave time they copy the installed biocstyle Quarto extension to _extensions/biocstyle next to the vignette (a user's existing _extensions/biocstyle is used as is, and other extensions in _extensions are left alone), render with quarto::quarto_render(output_format = 'biocstyle-html' / 'biocstyle-pdf') passing the version of the package named in 'package:' as 'package-version' metadata, then remove only what they created. Only the exported quarto API is used; quarto goes in Suggests. Without the quarto package or the Quarto CLI the engines error, except under R CMD check, where they warn and write a placeholder. Tangling and spell-checking reuse knitr's rmarkdown engine. DESCRIPTION: quarto in Suggests, BiocStyle added to VignetteBuilder (for BiocStyle's own Quarto vignette), SystemRequirements mentions Quarto. Engine adapted from #115 by Marcel Ramos (@LiNk-NY). Co-Authored-By: Claude <noreply@anthropic.com>
use_vignette_quarto(name, format = c('html', 'pdf')) creates
vignettes/<name>.qmd from inst/quarto/templates/vignette.qmd, with the
%\VignetteIndexEntry and %\VignetteEngine{BiocStyle::quarto_<format>}
header and the package-vignette structure from #76 (installation, quick
start, support site, bug reports, session info). It then calls
use_quarto_extension().
use_quarto_extension(dir = 'vignettes') copies the extension to
<dir>/_extensions/biocstyle so 'quarto render' and the RStudio Render
button work when previewing, and adds <dir>/_extensions and the
Bioconductor.sty that PDF previews leave behind to .Rbuildignore and
.gitignore when those files exist. An existing _extensions/biocstyle is
only replaced with overwrite = TRUE; other extensions are never touched.
Also ignore BiocStyle's own preview leftovers in vignettes/.
Co-Authored-By: Claude <noreply@anthropic.com>
inst/unitTests/test_quarto.R renders inst/unitTests/cases/quarto_parity.qmd with both engines and checks one structural marker per row of the parity map in #121: title, subtitle, authors/affiliations/email, abstract, package line with version, left TOC, numbered sections, margin footnote, fig-small/fig-wide classes, scroll-wrapped table, Biocpkg()/CRANpkg() links, and the SCSS palette in the embedded CSS. The PDF test checks that it compiles and, with pdftotext, the title block text. Also tests use_vignette_quarto() and use_quarto_extension() in a temporary package, that neither the engine nor use_quarto_extension() deletes an existing _extensions, the ../DESCRIPTION version fallback used when previewing, and that the extension's Bioconductor.sty matches inst/resources/tex/Bioconductor.sty. Rendering tests are DEACTIVATED when the quarto package or CLI is missing. Co-Authored-By: Claude <noreply@anthropic.com>
- Move the fig-small / fig-wide handling to biocstyle-figures.lua, run at pre-ast so fig-wide also maps to column-page-right on figure divs and Markdown images before Quarto turns them into floats. Metadata handling stays in biocstyle.lua at the default stage, after Quarto has normalized authors. - PDF header: define Shaded when the document has no highlighted code. Co-Authored-By: Claude <noreply@anthropic.com>
A Quarto vignette built with BiocStyle::quarto_html that documents and demonstrates the biocstyle formats: setup (DESCRIPTION fields, header, use_vignette_quarto(), previewing with use_quarto_extension()), a table mapping R Markdown features to their Quarto equivalents, the title block, style macros, regular/small/wide figures, scrolling tables, margin footnotes, and PDF output. Co-Authored-By: Claude <noreply@anthropic.com>
URLdecode() grows its output byte by byte and took over a minute on the embedded Bootstrap stylesheet; decode with a vectorized helper instead. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- check.yml: install the Quarto CLI with quarto-dev/quarto-actions/setup@v2 (plus sudo/jq/wget, which the action needs in the container) before R CMD check, so the Quarto vignette and test_quarto.R run. - render-matrix.yml: same setup; build AuthoringQuartoVignettes.qmd with the BiocStyle::quarto_html engine and run test_quarto.R. - install-tex.R: add LaTeX packages Quarto's template uses. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- R CMD check sets R_TESTS to a startup file relative to tests/, which the R process Quarto starts cannot find, so rendering from unit tests (or any package's tests) failed. Unset it for the duration of the render. - Update the extension's copy of Bioconductor.sty to devel's (#122 subtitle support); test_quarto_extension_sty_matches_resources caught the drift. With it, the Quarto PDF subtitle is typeset by Bioconductor.sty's \maketitle as in pdf_document. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # .github/scripts/install-tex.R
Follow devel's #53 change to parse_auth_affil()/auth_affil_latex(): when every author has the same single affiliation, the title block shows the affiliation without superscript numbers (HTML), and the PDF emits an unmarked authblk \affil in block layout. Tested in test_quarto_preview_reads_description. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # .Rbuildignore # .gitignore
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the Quarto feature parity tracked in #121: a
biocstyleQuarto extension bundled with BiocStyle (formatsbiocstyle-htmlandbiocstyle-pdf), vignette enginesBiocStyle::quarto_html/BiocStyle::quarto_pdf,use_vignette_quarto()/use_quarto_extension(), an "Authoring Quarto vignettes" vignette, tests, and CI.Parity map
BiocStyle::html_documentthemebiocstyle-html: SCSS theme (BiocBlue#1a81c2headings/links, green#87b13ftitle, shaded code, table header shading)BiocStyle::pdf_document(Bioconductor.sty)biocstyle-pdfloads the sameBioconductor.styviainclude-in-headertitle-block.html(HTML) andtitle.tex/before-body.texpartials (authblk, PDF). Numbered affiliations,*email marks, no marks when all authors share one affiliation (follows #53)package:)package-version, or read from../DESCRIPTIONwhen previewingtoc: true,toc-location: left, "Contents" titlefig.small/fig.widefig-small/fig-wide(chunk optionclasses:or{.fig-small}on images/divs);fig-widemaps to Quarto'scolumn-page-rightdiv.horizontal-scrollreference-location: margin(HTML). PDF: same placement aspdf_document(bottom of page in both)Biocpkg(),CRANpkg(),Githubpkg()%\VignetteEngine{knitr::rmarkdown}%\VignetteEngine{BiocStyle::quarto_html}/quarto_pdfuse_vignette_html()/use_vignette_pdf()use_vignette_quarto(name, format = c("html", "pdf"))inst/quarto/templates/vignette.qmd, used byuse_vignette_quarto()(package-vignette structure from #76)md_documentgfmtitlecaps, bold blue first sentence)Design notes
inst/quarto/_extensions/biocstyle/(notbioconductor/biocstyleas sketched in Quarto feature parity with R Markdown vignettes #121), so formats arebiocstyle-html/biocstyle-pdf, matching the existingBioconductor/quarto-extensionsdraft.Bioconductor.styworked, so no reduced header was needed. The extension carries a copy (shipped next to the document withformat-resources, because\usepackagecannot see the installed package's path);test_quarto_extension_sty_matches_resourcesfails if the two copies drift, and it already caught pdf_document: subtitle is never shown in the PDF #122's change, which is synced here. Three partials replace Quarto'stitle.tex,before-body.texandtoc.texwith the authblk author block, abstract,\packageVersion{}and a TOC on its own page. The format setsdocumentclass: articleandpdf-engine: pdflatex(the sty passespdftexto hyperref), and Quarto'sShadedandverbatimenvironments use the sty'smyshaded.biocstyle-figures.luaruns atpre-ast, before Quarto turns figures into floats.biocstyle.luahandles metadata after Quarto normalizes authors (by-author/by-affiliation).biocstyle-post.luaruns atpost-renderand handles table wrapping plus the soul-safe inline code thatpdf_document's post-processor also produces.fig-smallwithfig-width: 5andfig-widewithfig-width: 10(the format defaults to 8×5). That matchesfig.small/fig.wide. Quarto has no user opts_hooks, so this can't be automatic.quarto_path(),quarto_render()). At weave time they copy the installed extension to_extensions/biocstylenext to the input; an existing_extensions/biocstyleis used as is, and other extensions are never touched. They then render, remove only what they created (plus theBioconductor.stythatformat-resourcesdrops), and move the output to the working directory when it differs from the input's directory (tools::buildVignette(dir=)). During the render they setR_LIBSfrom.libPaths()and unsetR_TESTS; without that, rendering fromR CMD checktests failed because Quarto's R process could not findstartup.Rs. Without Quarto: error interactively; underR CMD check, warn and write a placeholder (as in add BiocStyle quarto engine #115). Tangle and aspell come from knitr's rmarkdown engine.use_quarto_extension()copies the extension intovignettes/_extensions/and addsvignettes/_extensionsandvignettes/Bioconductor.styto.Rbuildignore/.gitignorewhen those files exist. BiocStyle's own.Rbuildignoregets the same two entries, and the repo gets a new.gitignorewith them.quartoin Suggests,VignetteBuilder: knitr, BiocStyle,SystemRequirementsmentions Quarto (optional). NAMESPACE has two new exports; onlyman/use_vignette_quarto.Rdis new. roxygen2 8.1.0's reformatting of NAMESPACE/DESCRIPTION was reverted to keep the diff small.check.ymlandrender-matrix.ymlinstall Quarto withquarto-dev/quarto-actions/setup@v2, after apt-installingsudo jq wget curl, which the action needs inside the Bioconductor container. The render matrix also builds the Quarto vignette and runstest_quarto.R. These steps use Quarto's bundled pandoc, so they don't vary with the matrix.required-packages.txtgains a section with the TeX packages Quarto's template uses; that edit landed in the merge commit that resolved theinstall-tex.Rconflict.How to try it
Then
quarto render vignettes/MyPackage.qmd(or the RStudio Render button), orR CMD buildwithVignetteBuilder: BiocStyleandSuggests: BiocStyle, knitr, quarto.vignette("AuthoringQuartoVignettes", package = "BiocStyle")walks through every feature and has a table mapping R Markdown features to Quarto.Verification (local, macOS arm64, R 4.6.0, Quarto 1.9.38, quarto R 1.5.1)
R CMD buildthen_R_CHECK_FORCE_SUGGESTS_=false R CMD check --no-manual(after merging devel at 5fd68a9): Status: OK, no NOTEs/WARNINGs/ERRORs. 57 RUnit test functions with 0 errors and 0 failures, including 10 intest_quarto.R.R CMD check (Bioc devel), the Quarto vignette built and the run ended with 1 NOTE (pdf_document.Rd: includesmissing a package anchor), which devel's own run also reports. In every pandoc-matrix job,test_quarto.Rran 10 functions with 0 errors, 0 failures and none deactivated. The advisory BiocCheck step adds one new warning: BiocStyle is listed inVignetteBuilderbut not in its own Suggests. The quarto package handles the same self-reference the same way, so I left it.test_quarto.Rwith Quarto hidden from PATH: 4 rendering tests DEACTIVATED, the rest pass.buildVignette()errors interactively and warns plus writes a placeholder when_R_CHECK_PACKAGE_NAME_is set.quarto-required: ">=1.4.0"is a guess, sinceat:filter entry points andformat-resourcesneed ≥1.4).Not done
titlecaps: bold blue first sentence of figure/table captions) in HTML.Biocpkg()& co.; inline R works.use_vignette_quarto()is the entry point.crop, and the HTML body isn't indented under hanging section numbers ashtml_document's is.Bioconductor/quarto-extensionsis not updated to mirror this extension.Open questions for maintainers
fig-small/fig-widewith a recommendedfig-widththe idiom you want, or should we document Quarto'scolumn:options only?Bioconductor.styin the extension, guarded by a test, acceptable, or would you prefer the engine copy it in at render time? The trade-off: the extension would no longer be self-contained for previews and for mirroring.quarto-extensionsmirror this extension?Supersedes #115. Many thanks to Marcel Ramos (@LiNk-NY) for the engine in #115, which this adapts, and to @federicomarini for the palette and testing in #114/#115.