Copy and rebase user-declared stylesheets (format.html.css) — bd-format-css-not-copied-crn3bjdz - #538
Open
cscheid wants to merge 6 commits into
Open
Copy and rebase user-declared stylesheets (format.html.css) — bd-format-css-not-copied-crn3bjdz#538cscheid wants to merge 6 commits into
cscheid wants to merge 6 commits into
Conversation
…r copied nor rebased Plan skeleton + minimal repro fixture. Both defects confirmed at HEAD (10d8682): declared css files never written to _site, hrefs emitted verbatim at every page depth beside correctly-rebased site_libs links, no diagnostic. Verdict: ready to design; open questions on output layout (Q1 site_libs/quarto-contrib parity vs project-relative copy), rebase mechanism (Path-kind metadata marking vs resource resolver), and scope (books, js/format-resources, doc-level css). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Record user design decisions; add Q1 (quarto-cli) evidence for the site_libs/quarto-contrib/quarto-project relocation rationale and the metadata-time rebase mechanism (toInputRelativePaths); add q2 boundary audit (revealjs drops user css entirely; format-resources accepted but never consumed; books use DefaultProjectType with no post-render). Propose hybrid mechanism (merge-time Path marking + render-time resolver transform); four follow-up questions (F1-F4) pending. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… filed F1 hybrid mechanism approved (merge-time Path marking + render-time resolver transform); F2 revealjs user-css drop fixed in-strand; F3 css url() chasing filed as bd-dxp854dw (p2); F4 format-resources no-op filed as bd-ptb0v2lk (p2). Ready to implement on go-ahead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…opied-crn3bjdz) User-declared stylesheets (format.html.css / document css:) are now copied into the output tree and linked with depth-correct per-page hrefs, Q1-parity: - project-relative paths mirror into the output (_site/styles.css); - _extensions/** entries relocate to <lib_dir>/quarto-contrib/quarto-project/** so the _extensions tree never ships (manifests, Lua sources, READMEs stay out); - document front-matter css: resolves against the document's own directory; a leading / anchors at the project root; - external URLs pass through verbatim; - revealjs decks now link user css (previously dropped entirely); - missing files warn with new code Q-5-29 (catalog + docs page): once per project render for _quarto.yml entries, per document for front-matter entries; the broken link is still emitted. Mechanism (per the plan's settled design): existence-driven per-layer Path-kind marking in MetadataMergeStage (project/format_css.rs) + a Normalization-phase FormatCssTransform that pushes ResourceCopyIntents and rewrites entries to resolver-computed hrefs. Works for websites, default projects/books, and single-doc renders; VFS/preview mode deliberately untouched (Phase 4 follow-up). Snapshot note: no .snap files changed. One smoke-all fixture expectation updated (extensions/format-with-theme): bundled extension css now links at its relocated quarto-contrib path instead of the in-source _extensions path — and is actually copied, so it survives a separate output-dir. Tests: 9 new end-to-end integration tests (format_css.rs, written first and verified failing at HEAD), 6 unit tests; full workspace suite green (12182 passed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…bjdz) The WASM preview/hub leg runs the same orchestrator and metadata merge, but its runtime probes the VFS — which is not authoritative for non-qmd project files. A stylesheet that exists on disk but is not synced produced a false 'Q-5-29 css refers to missing file' warning in the preview overlay (observed in a real browser session against q2 preview). Emit the missing-css diagnostics only in native renders, where the output tree is real. Verified in the browser after rebuilding the WASM -> SPA -> q2 chain: the preview renders the fixture with no warning overlay. Preview still does not APPLY user css (VFS-mode transform no-op, per the settled design) — filed as bd-b3oq2fsy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
A website project declaring stylesheets the ordinary way
previously got a
<link>to each file on every page while neither file was written into the output tree and the href was emitted verbatim at every page depth — every link 404'd, silently (exit 0, no diagnostic). Real-world impact: all 352 pages of the Posit Connect docs port linked two nonexistent stylesheets.This PR makes user-declared css a first-class project asset, Q1-parity:
_site/styles.css); entries under_extensions/relocate to<lib_dir>/quarto-contrib/quarto-project/**so the_extensions/tree (manifests, Lua sources, READMEs) never ships. Copies ride the per-pageResourceCopyIntentchannel, so websites, default projects/books, and single-doc renders are all covered.styles.cssat the root,../../styles.csstwo levels down), computed by the per-pageResourceResolverContext._quarto.ymlentries anchor at the project root,_metadata.ymlat its directory, document front matter at the document's own directory; a leading/anchors at the site root. Provenance is captured by existence-driven Path-kind marking inside the metadata merge (the same seam Q1'stoInputRelativePathsuses), while emission stays resolver-driven.css:was previously dropped entirely on reveal decks (not even a broken link); the resolved list is now appended after the vendored deck assets.Design + evidence trail:
claude-notes/plans/2026-08-14-format-css-not-copied.md(includes the quarto-cli study of thequarto-contrib/quarto-projectlayout rationale and the q2 asset-boundary audit).One deliberate Q1 divergence: Q1 relocates
_extensions/css only for website/book projects and mirrors it verbatim for default-type projects; q2 relocates uniformly, so bundled extension css also survives a separateoutput-dirin default projects.Follow-ups filed (discovered-from): bd-b3oq2fsy (preview does not apply user css — VFS-mode no-op), bd-dxp854dw (css
url()/@importchasing), bd-ptb0v2lk (format-resourcesaccepted but never consumed).Test plan
crates/quarto-core/tests/integration/format_css.rs) drivingProjectPipeline/render_to_file, written first and verified failing at HEAD: copy, per-depth hrefs,quarto-contribrelocation, doc-relative front-matter css, Q-5-29 + render-continues, external-URL passthrough, default-project coverage, revealjs linking, theme-before-user-css ordering.!pathcases).cargo xtask verifygreen (all legs, incl. WASM); workspace suite 12182 passed.q2 previewexercised in a real browser session (no warning overlay; page renders)..snap) changes. One smoke-all fixture expectation updated (extensions/format-with-theme): bundled extension css now links at its relocatedquarto-contribpath and is actually copied.🤖 Generated with Claude Code