This repository packages a minimal Quarto project plus an R-based reference validator so you can prototype manuscripts, verify citations/DOIs, and publish directly to GitHub Pages. Use it as a starting point for new reports or as a sandbox for testing Quarto workflows.
This repository is a minimal Quarto workspace with:
index.qmd: starter document wired toreferences.biband the AMA CSL, including demo paragraphs that cite@smith2023,@lee2022,@chen2021, and@garcia2020.sections/: modular.qmdfiles (Abstract, Introduction, Methods, Results, Discussion, Conclusion, Acknowledgements) thatindex.qmdimports via Quarto include shortcodes.references.bib: sample BibTeX database you can replace with your own sources.AMA.csl: American Medical Association CSL style downloaded from Zotero.helper.R: helper script that validates citations in.qmdfiles against the BibTeX file and optionally checks DOI resolvability.
- Install Quarto (https://quarto.org/docs/get-started/) and make sure
Rscriptis available on your path. - Clone or copy this folder to wherever you plan to write your document.
- Edit
index.qmd(or add more.qmdfiles) with your content and cite using@citekeysyntax. - Replace
references.bibwith your bibliography. You can paste BibTeX entries directly into the file, one per reference. - Edit the files under
sections/to update each manuscript section;index.qmdautomatically aggregates them in IMRaD order.
- The Introduction demonstrates a full CARS-style narrative with inline and grouped citations.
- The Methods, Results, and Discussion modules provide structured bullet-point prompts you can replace with study-specific prose.
- Each section currently contains placeholders for key data (design choices, numerical results, interpretations); swap them out with your manuscript content when ready.
references.bibships with four sample entries that correspond to the cite keys used inindex.qmd.- Use this setup to test the helper script before swapping in your own text and bibliography.
The helper script can scan your .qmd files and verify that every cited key exists in the BibTeX file. It can also issue HEAD requests to https://doi.org/<doi> to confirm DOI responses.
# Validate everything automatically (searches for *.qmd and references.bib)
Rscript helper.R
# Specify files explicitly
Rscript helper.R paper.qmd references.bib
# From an R session
source("helper.R")
check_refs(check_doi = TRUE)The script prints:
- Missing citations (
@keyused in.qmdbut not found in.bib). - Unused bibliography entries.
- DOI validation summary (valid, invalid, missing).
After the references pass validation, render the Quarto project (the front matter already requests both HTML and DOCX output):
quarto render index.qmdQuarto writes index.html and index.docx into _site/ by default. Use quarto render index.qmd --to html --to docx if you explicitly want to control the formats on the command line.
- Paste or write text into
.qmdfiles. - Paste corresponding BibTeX entries into
references.bib. - Run
Rscript helper.R(or usecheck_refs()in R) to ensure citations/DOIs are valid. - Run
quarto render index.qmdto generate HTML + DOCX outputs under_site/.
- The workflow at
.github/workflows/quarto-gh-pages.ymlruns on every push tomain. It checks out the repo, installs Quarto + R, installshttr/bib2df, rendersindex.qmdinto_site/, and uploads that folder as the Pages artifact. - In the GitHub repo settings, enable Pages with Source → GitHub Actions so that
actions/deploy-pagescan publish from the workflow. - After the workflow succeeds, the
deployjob publishes the generated site to the GitHub Pages environment and surfaces the live URL in the Actions log (https://htlin222.github.io/quarto-doc/). - You can always browse the published document at https://htlin222.github.io/quarto-doc/.
You can include external R scripts in your .qmd files using the file chunk option. This keeps your analysis code modular and reusable.
```{r, file='scripts/analysis.R'}
```This will read and execute the contents of scripts/analysis.R as if the code were written directly in the chunk.
You can also source multiple files in a single chunk:
```{r, file=c('scripts/setup.R', 'scripts/analysis.R')}
```For file paths to resolve correctly from the project root (rather than relative to each .qmd file's location), this project uses:
# _quarto.yml
project:
type: default # or manuscript, book, website, etc.
execute-dir: projectWith execute-dir: project, all R code chunks execute with the working directory set to the project root. This means:
file='scripts/data.R'looks for<project-root>/scripts/data.Rread.csv('data/input.csv')looks for<project-root>/data/input.csv- Paths work consistently regardless of which subdirectory your
.qmdfile is in
Without this setting, Quarto defaults to execute-dir: file, where paths are relative to each .qmd file's directory—which can cause confusion when .qmd files are in subdirectories like sections/.
- Validate everything automatically (search for all
.qmdfiles +references.bib):Rscript helper.R
- Validate specific files:
Rscript helper.R paper.qmd references.bib
- From an interactive R session:
source("helper.R") check_refs(check_doi = TRUE) # set FALSE to skip DOI checks