Skip to content

Don't render the macros submodule's .qmd files directly - #84

Merged
d-morrison merged 1 commit into
mainfrom
fix/exclude-macros-submodule-render
May 26, 2026
Merged

Don't render the macros submodule's .qmd files directly#84
d-morrison merged 1 commit into
mainfrom
fix/exclude-macros-submodule-render

Conversation

@d-morrison

Copy link
Copy Markdown
Collaborator

Problem

Quarto Publish renders macros/index.qmd and macros/macros-table.qmd from the macros git submodule as standalone site pages (files 5–6 of 7 in the render). macros-table.qmd uses DT::datatable() (an HTML widget), which errors when the project also renders to PDF:

Error: Functions that produce HTML output found in document targeting pdf output.

(This surfaced after #82 installed DT and the render got past the earlier no package called 'DT' error.)

Fix

Per the request to not touch the submodule, exclude its directory from the project render list in _quarto-website.yml:

render:
  ...
  - "!macros/"

The submodule's files remain available as resources for includes/shortcodes (e.g. macros-table.qmd still readLines("macros.qmd")); they're just no longer rendered as standalone pages. Verified nothing in the qwt site links to the macros/ pages, so no broken links.

Test plan

  • This PR's preview render no longer lists macros/index.qmd or macros/macros-table.qmd (render count drops from 7 to 5).
  • After merge, Quarto Publish on main goes green (the PDF/HTML-widget error can't occur if the file isn't rendered).

🤖 Generated with Claude Code

The `macros` submodule supplies macro definitions for include/shortcode
use, but its index.qmd / macros-table.qmd were being rendered as standalone
site pages. macros-table.qmd uses DT::datatable() (an HTML widget), which
errors under the project's PDF format ("Functions that produce HTML output
found in document targeting pdf output"), breaking Quarto Publish.

Exclude the submodule directory from the project render list (`!macros/`).
The files remain available as resources for includes/shortcodes; they're
just no longer rendered as pages. Nothing in the qwt site links to them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 26, 2026 16:45
@claude

claude Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

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


Code Review — PR #84

  • Read changed files and gather context
  • Analyze the fix
  • Post review

Summary: The fix is minimal, targeted, and correct. One minor question about glob specificity; comment is on the verbose side but defensible.


_quarto-website.yml — the only changed file

The exclusion pattern

- "!macros/"

This is the right place and the right mechanism — Quarto's project render list supports negation globs, and putting the exclusion here keeps the submodule files available as include/shortcode resources without rendering them as standalone pages.

One thing worth double-checking: Quarto's glob handling of a trailing-slash pattern (macros/) vs. an explicit wildcard (macros/**). The trailing-slash form is less standard in glob libraries and could behave differently across Quarto versions. The more unambiguous form would be:

- "!macros/**"

If you've confirmed !macros/ drops the render count from 7 to 5 in your test run, it works — just flagging that !macros/** is more explicit and easier to reason about for template consumers who may wonder why it stops at the directory boundary.

The comment

The 4-line comment explaining why the submodule is excluded is useful — the DT/PDF conflict is genuinely non-obvious. But it's slightly verbose for a config file. Could be tightened to one or two lines, e.g.:

# macros/ is a submodule for includes/shortcodes, not standalone pages;
# macros-table.qmd uses DT::datatable() which errors on PDF output.
- "!macros/"

This is minor — either form is acceptable.

Template impact

No concerns. Downstream books that don't use the macros submodule are unaffected (pattern matches nothing). Books that do use it get the same rendering fix.

Build hygiene

No _site/, _freeze/, or .quarto/ artifacts committed. No new R dependencies. Clean.


Verdict: Ready to merge with the glob form as a minor suggestion. The core fix is sound.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Quarto website configuration to prevent .qmd files from the macros/ git submodule from being rendered as standalone site pages, avoiding PDF render failures caused by HTML-only output (e.g., DT::datatable()).

Changes:

  • Exclude the macros/ submodule directory from project.render in _quarto-website.yml.
  • Add inline documentation explaining why the submodule is excluded (HTML widget incompatibility with PDF output).

@d-morrison
d-morrison merged commit fd082ec into main May 26, 2026
8 of 9 checks passed
@d-morrison
d-morrison deleted the fix/exclude-macros-submodule-render branch May 26, 2026 17:10
@d-morrison d-morrison mentioned this pull request May 26, 2026
2 tasks
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-26 10:13 PDT

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