Skip to content

Convert psw from a Quarto book to a qwt-template website - #28

Merged
d-morrison merged 4 commits into
mainfrom
convert-to-website
Jun 18, 2026
Merged

Convert psw from a Quarto book to a qwt-template website#28
d-morrison merged 4 commits into
mainfrom
convert-to-website

Conversation

@d-morrison

Copy link
Copy Markdown
Collaborator

Converts Principles of Scientific Writing from a Quarto book into a Quarto website modeled on the d-morrison/qwt template. psw's content already used definition/example/theorem div environments; this brings in the qwt extensions that render them as styled callouts, plus multi-format output and the qwt CI suite.

Highlights

  • Config: book _quarto.yml → website profile pair (_quarto.yml base + _quarto-website.yml), output to _site/. Navbar: Home · Chapters dropdown · References · GitHub.
  • Structure: content pages moved into chapters/; each page gets multi-format front matter (HTML site + RevealJS slides + PDF handout + DOCX). index.qmd (Preface) and references.qmd stay at root.
  • Theorem rendering: ports qwt's _extensions/ (callouty-theorem, custom-callout, div-anchors, equation-anchors, slidebreak), the reveal lua filters, styles.css/styles-reveal.scss, and the reveal light/dark toggle.
  • Workflows: publish.yml/preview.yml now deploy _site/ (with R setup + freeze cache); added check-non-standard-chars, lint-changed-files, and the qwt-derived @claude agent + review workflows (these supersede the basic ones added by /install-github-app).
  • Metadata: DESCRIPTION, .gitignore, .Rbuildignore, lychee.toml, .lintr.R, .gitattributes, and a psw-adapted CLAUDE.md.
  • Merged main: the new paper-organization chapter is integrated into chapters/ with front matter and a navbar entry.

Verified locally (Quarto 1.9.36 / R 4.6.0)

  • Full quarto render builds all 7 chapters + index/references into _site/.
  • defining-terms renders #def-/#exm-/#thm- blocks as colored theorem callouts.
  • A sample chapter produced all four formats (HTML, -slides.html, .docx, -handout.pdf).
  • All 12 workflow YAMLs parse; publish/preview target _site/.

Notes

  • The @claude bots require the CLAUDE_CODE_OAUTH_TOKEN secret — already present in this repo.
  • No macros git submodule added (psw uses none).

🤖 Generated with Claude Code

d-morrison and others added 2 commits June 2, 2026 11:27
Restructure the Principles of Scientific Writing book into a Quarto
website modeled on d-morrison/qwt:

- Replace the book _quarto.yml with a website profile pair
  (_quarto.yml base + _quarto-website.yml), output to _site/.
- Move content pages into chapters/ and give each page multi-format
  front matter (HTML site + RevealJS slides + PDF handout + DOCX).
- Port qwt's theorem-callout extensions, lua filters, styles, and the
  reveal light/dark toggle so the existing def/exm/thm environments
  render as colored callouts.
- Add the qwt CI/automation suite: _site-based publish/preview,
  check-non-standard-chars, lint-changed-files, and the @claude agent
  and review workflows.
- Update DESCRIPTION, .gitignore, .Rbuildignore, lychee.toml, and add
  a psw-adapted CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	.github/workflows/claude-code-review.yml
#	.github/workflows/claude.yml
#	_quarto.yml
@d-morrison

Copy link
Copy Markdown
Collaborator Author

@claude review

@claude

claude Bot commented Jun 3, 2026

Copy link
Copy Markdown

Claude finished @d-morrison's task in 3m 42s —— View job


Code Review

  • Gather context
  • Read CLAUDE.md and repo guidelines
  • Review configuration changes (_quarto.yml, _quarto-website.yml)
  • Review workflow changes
  • Review extensions and Lua filters
  • Review content structure changes
  • Post final review

Overall, this is a well-structured and thorough conversion. The config profile split, extension porting, multi-format front matter, and qwt workflow suite are all implemented cleanly. A few issues need attention before merging, most critically a CI check that will fail on existing content.


Blocking issues

1. check-non-standard-chars CI will fail immediately on existing content

chapters/citations-evidence.qmd already uses em-dashes () at lines 73 and 202:

provide a citation—over-citing is preferable to under-citing.
...is not optional—it is essential to scientific communication.

The new .github/workflows/check-non-standard-chars.yaml runs on pull_request targeting main, which means it will fail on this PR itself. Em-dashes are standard typographic characters in academic/scientific prose and should not be treated as errors in .qmd content.

Options:

  • Remove (en dash) and (em dash) from NON_STANDARD_CHARS in .github/scripts/check-non-standard-chars.py — curly quotes are the real issue in .qmd/.R files, not dashes.
  • Or apply the em/en-dash check only to .R files, where they'd actually break parsing.

Fix this →


Non-blocking issues

2. publish.yml uses quarto-dev/quarto-actions/setup@HEAD (unpinned)

Every other use of quarto-actions in this repo uses @v2 (including the render step in the same workflow and preview.yml). @HEAD means the action resolves to whatever is on the default branch of quarto-actions at run time, which could pick up breaking changes silently.

publish.yml:21:

uses: quarto-dev/quarto-actions/setup@HEAD   # ← unstable

Should match:

uses: quarto-dev/quarto-actions/setup@v2

Fix this →

3. Timezone set twice in both publish.yml and preview.yml

Both workflows set TZ: America/Los_Angeles at the job level via env: AND again in a dedicated step (echo "TZ=..." >> $GITHUB_ENV). The step is redundant when a job-level env: already sets the variable for every step. Pick one approach and remove the other.

publish.yml:13-14 and publish.yml:39-41:

env:
  TZ: America/Los_Angeles    # ← job-level
...
- name: Set timezone to Pacific Time
  run: echo "TZ=America/Los_Angeles" >> $GITHUB_ENV  # ← redundant

4. execute: and knitr: blocks duplicated across _quarto.yml and _quarto-website.yml

Both files contain identical:

execute:
  warning: false
  message: false
  cache: false
  freeze: auto
knitr:
  opts_chunk:
    collapse: true
    comment: "#>"

Since _quarto.yml is the base and _quarto-website.yml is the profile overlay, the values in _quarto.yml are already inherited unless overridden. The duplication in _quarto-website.yml is harmless but creates a maintenance hazard — updating one but not the other would cause a silent mismatch. Consider removing the duplicate block from _quarto-website.yml unless you intentionally want the profile to win.

5. index.qmd still says "This book"

index.qmd:18:

"This book will present my perspective on scientific writing..."

After the conversion to a website, this should read "This website will present..." (or "This guide will present..." for format-neutral language).

Fix this →

6. chapters/intro.qmd is an empty placeholder

The file has only a YAML front matter block and no body content. It will render as a blank page in the navbar. Either add stub content or mark it draft: true in the front matter until it's filled in.

7. styles.css contains large commented-out template boilerplate

styles.css lines 1–38 are commented-out template examples (heading colors, paragraph margins, code blocks, callouts). These appear to be copy-paste artifacts from a starter template. They add ~40 lines of noise with no functional value. Fine to keep if there's intent to uncomment them, but otherwise worth trimming.


Minor observations

  • _quarto-website.yml render exclusion "!README.md": There is currently no README.md at the repo root, so this exclusion is a no-op. It's a forward-looking guard (fine), but could mislead someone checking why a file isn't rendering.

  • appendix-document-metadata.qmd: Has 4–5 trailing blank lines after the closing ::: (lines 39–43). Not a build issue but minor.

  • _quarto-website.yml global filters include RevealJS-specific Lua: revealjs-level1-slide-breaks.lua and revealjs-html-links.lua run for all formats via the base filters: list in _quarto.yml. As long as those filters guard on FORMAT == "revealjs" internally, this is fine — worth a quick sanity check if PDF/DOCX output ever behaves unexpectedly.

  • DESCRIPTION: RoxygenNote: 7.3.3 is present — this is typically auto-updated by devtools::document(). Fine to leave; just make sure roxygen2 >= 7.3.3 is available in the CI where devtools::document() runs.


Suggested follow-up @claude prompt

@claude address review comments in [this review](https://github.com/d-morrison/psw/pull/28)

@d-morrison

Copy link
Copy Markdown
Collaborator Author

Claude Code CLI (local session) is working on this — paws off until I'm done.

Fixes the blocking CI issue plus the non-blocking nits from the
@claude review on the book-to-website conversion:

- check-non-standard-chars.py: stop flagging en/em dashes; they are
  valid typographic characters in prose .qmd content (the existing
  chapters/citations-evidence.qmd uses em-dashes, which would have
  failed the new CI check on this PR). Curly quotes remain flagged.
- publish.yml: pin quarto-actions/setup to @v2 (was @Head) to match
  every other quarto-actions usage in the repo.
- publish.yml + preview.yml: drop the redundant "Set timezone" step;
  the job-level `env: TZ` already covers all steps.
- _quarto-website.yml: remove duplicated execute:/knitr: blocks; they
  are inherited from the base _quarto.yml.
- index.qmd: "This book" -> "This website" after the conversion.
- chapters/intro.qmd: mark draft: true (empty placeholder page).
- styles.css: trim commented-out starter-template boilerplate.
- appendix-document-metadata.qmd: trim trailing blank lines.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@d-morrison

Copy link
Copy Markdown
Collaborator Author

Addressed the review (commit ff7f5d7).

Blocking

  • avoid vague and metaphorical language #1 em-dash CI failure — removed the en-dash (U+2013) and em-dash (U+2014) entries from NON_STANDARD_CHARS in .github/scripts/check-non-standard-chars.py (plus docstring/report text). They're valid prose characters; curly quotes are still flagged. Verified the checker now passes (exit 0) on the existing content, including the em-dashes in chapters/citations-evidence.qmd.

Non-blocking — all fixed

Minor observations

  • Trailing blank lines trimmed in appendix-document-metadata.qmd.
  • !README.md render exclusion: left as a forward-looking guard (your note).
  • RevealJS Lua filters: confirmed both revealjs-level1-slide-breaks.lua and revealjs-html-links.lua guard on FORMAT == "revealjs" and early-return otherwise — safe for PDF/DOCX.
  • DESCRIPTION RoxygenNote: left as-is per your note.

@claude review

@claude

claude Bot commented Jun 3, 2026

Copy link
Copy Markdown

Claude finished @d-morrison's task in 1m 8s —— View job


Code Review (follow-up)

  • Gather context
  • Read CLAUDE.md and repo guidelines
  • Review commit ff7f5d7 (review feedback addressed)
  • Verify each blocking/non-blocking issue from previous review
  • Post final review

All items from the previous review are correctly addressed in commit ff7f5d7. Verified each fix against the current branch state:

# Issue Fix Verified
1 (blocking) check-non-standard-chars CI failure on em-dashes En/em dashes removed from NON_STANDARD_CHARS; docstring updated to explain the intentional exclusion
2 publish.yml unpinned @HEAD Changed to @v2
3 Redundant timezone step in both workflows Step removed from publish.yml and preview.yml; job-level env: TZ remains
4 Duplicate execute:/knitr: in _quarto-website.yml Blocks removed; replaced with a comment noting they're inherited from base
5 index.qmd still said "This book" Changed to "This website"
6 chapters/intro.qmd empty placeholder draft: true added to front matter
7 styles.css commented-out boilerplate Trimmed to a single descriptive header comment
(minor) Trailing blank lines in appendix-document-metadata.qmd Cleaned; file now ends cleanly after the closing :::

No new issues introduced by ff7f5d7. The commit is clean — surgical changes only, no unrelated modifications.

This PR is ready to merge.

Resolves the merge conflict with main and the failing build-deploy check
on PR #28.

Merge conflict (main's PR #19 "add-chapter-disclaimer"):
- main added `{{< include _copilot-disclaimer.qmd >}}` to intro, summary,
  conciseness and word-choice. On this branch those pages moved into
  `chapters/`, so the partial moves with them to
  `chapters/_copilot-disclaimer.qmd` (Quarto resolves include paths
  relative to the including file, and `_`-prefixed files are not rendered
  as standalone pages — both verified).
- conciseness/word-choice auto-merged; the disclaimer include is applied
  by hand to chapters/intro.qmd and chapters/summary.qmd, keeping this
  branch's website front matter and "this website" wording.
- main's CI consolidation (check-links.yml, summary.yml,
  copilot-instructions.md) carried over unchanged.

build-deploy failure:
- detect-changed-chapters.py wrote changed-chapters.json to a hard-coded
  ./docs/, which no longer exists after the book→website conversion
  (output is now _site/), so the step crashed with FileNotFoundError.
- Write to `rendered_dir` (HTML_DIR, set to ./_site in preview.yml)
  instead, matching the location add-home-banner.py reads from. Falls
  back to ./docs when HTML_DIR is unset, preserving legacy behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KhG1uJSeWTT6yfGhvS5GNG
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://d-morrison.github.io/psw/pr-preview/pr-28/

Built to branch gh-pages at 2026-06-18 17:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@d-morrison
d-morrison merged commit 3f0bb95 into main Jun 18, 2026
8 checks passed
@d-morrison
d-morrison deleted the convert-to-website branch June 18, 2026 19:24
d-morrison pushed a commit that referenced this pull request Jun 18, 2026
main advanced with the qwt-template conversion (#28), which pulled the
full inline claude.yml / claude-code-review.yml workflows from the
template. PR #31 migrates those same files to thin callers of the central
d-morrison/gha @v1 reusable workflows.

Conflict resolution keeps the PR's thin-caller versions: the reusable
claude.yml@v1 (823 lines) and claude-code-review.yml@v1 are supersets of
all the inline logic main carried (late-comment polling, dedup,
issue-branch setup, self-mod skip), and they expose exactly the inputs
the callers pass (setup-r, install-quarto, prompt-addendum, pr-number).
Migrating therefore loses no behavior while removing the duplicated
inline blocks.

Carried main's orthogonal on:-block refinement into the thin caller:
drop the `issues: assigned` trigger (the trusted-author gate keys on the
issue author, not the assigner, so `assigned` can't usefully grant
access). The caller-level concurrency block is intentionally omitted —
the reusable workflows define their own job-level concurrency, matching
the house thin-caller pattern from #29 (check-links.yml, summary.yml).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqzTSVzUdxymZnu4go9hFf
d-morrison pushed a commit that referenced this pull request Jun 18, 2026
… layout

main restructured the project from a Quarto `book` into the website-profile
layout (PR #28): content pages moved under `chapters/`, the chapter list moved
out of `_quarto.yml` (now `profile: default: website`) into the
`_quarto-website.yml` navbar, and pages now carry per-format front matter.

Resolved the `_quarto.yml` conflict by taking main's profile-based config, and
adapted the new Grammar chapter to the website layout:

- Moved `grammar.qmd` -> `chapters/grammar.qmd` and `grammar/` ->
  `chapters/grammar/` (include partials).
- Replaced the `# Grammar` book heading with website-style front matter
  (`title:` + html/revealjs/pdf/docx `output-file` stems), matching the other
  chapters.
- Registered "Grammar" in the `_quarto-website.yml` navbar between Word choice
  and Conciseness, and excluded `chapters/grammar/` from direct render (it holds
  include partials only), mirroring `chapters/defining-terms/`.
- Added "overfit" to `inst/WORDLIST` for the spell-check.

Verified with `quarto render chapters/grammar.qmd --to html` (examples 6.x
render and cross-reference) and a local `spelling` pass.
d-morrison pushed a commit that referenced this pull request Jun 20, 2026
Resolve conflict with the convert-to-website restructure (#28): the
new 'Limit complex sentence structures' section was added to the
root conciseness.qmd, while main moved that file to
chapters/conciseness.qmd. Git's rename detection carried the new
section into chapters/conciseness.qmd; net change vs. main is the
27-line addition only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BNqt1oGHGVxXjfgUiW6fLb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants