Add .code-with-filename CSS styles#272
Conversation
✅ Deploy Preview for posit-open-source canceled.
|
|
Not sure who is best to review this. This takes @cpsievert's changes and makes some updates. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds standalone CSS support for Quarto’s code-with-filename blocks and updates the test page to exercise filename labels and line numbers.
Changes:
- Add
.code-with-filenamecontainer/label styling and copy-button positioning. - Enable code line numbers on the test page.
- Add additional filename examples (path, long filename, R) to the
index.qmdtest content.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| content/test-filename/index.qmd | Enables line numbers and adds more filename= code-block examples for visual verification. |
| content/test-filename/index.md | Enables line numbers in frontmatter, but otherwise appears not regenerated to include new examples. |
| assets/css/main.css | Introduces styles for .code-with-filename blocks, label header, and copy-button positioning. |
Comments suppressed due to low confidence (1)
content/test-filename/index.md:55
- The PR description and
index.qmdadd new test sections (path filename, long filename, R example), butcontent/test-filename/index.mdis not updated to include them (it only addscode-line-numbers: trueand a trailing blank line). Ifindex.mdis the source consumed by the site/build, the new test cases won’t actually render. Recommend regeneratingindex.mdfrom the updated.qmd(or removingindex.mdfrom version control if it’s intended to be build output) so the test page content is consistent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses Copilot review comment: border-bottom was the same color as the background (both var(--color-blue-200)), making it visually redundant. Two other Copilot comments were evaluated and left unchanged: - "Redundant selector" on .prose .code-with-filename div.highlight: the dual selector is necessary. The existing .prose div.highlight rule uses !important at higher specificity (0,2,1) vs (0,1,1), so the .prose-scoped override is required to win the specificity battle. - "Magic number" on 1.1428571em padding: Tailwind-derived value consistent with existing patterns in this file; no change needed.
cwickham
left a comment
There was a problem hiding this comment.
Thanks so much @elnelson575 This looks fantastic!
Preview linksFull site: https://6a15c9a719d7f15c3b7d1cc0--posit-open-source.netlify.app |
Summary
Extracts the CSS changes from #244 as a standalone PR so they can merge independently (thanks @cpsievert!)
Adds styles for Quarto's
code-with-filenamefeature — code blocks that display a filename label above the code:Line numbers are enabled on the test page via
code-line-numbers: truein frontmatter, keeping to the convention of specifying this at the page level rather than per block.Test plan
filename=attribute render with a labeled header and bordered containercode-with-filenameblocks