Fix code copy and clarify javascript#1969
Merged
Merged
Conversation
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes legacy/inoperative front-end assets from the docs site and adjusts styling so Docsy’s built-in code-block copy button remains visible on dark-highlighted code blocks, while also eliminating a broken clarity.js reference.
Changes:
- Removed the legacy custom copy-code script and its associated (now-unused) CSS.
- Removed the stale
/js/clarity.jsreference and documented thatbody-end.htmlis intentionally empty. - Added an SCSS override to make Docsy’s built-in click-to-copy button visible on dark code blocks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/static/js/copy-code-button.js | Deleted legacy copy-button injection script that conflicted with Docsy’s built-in behavior. |
| docs/layouts/partials/hooks/body-end.html | Removed stale script includes and replaced with an explanatory Hugo comment. |
| docs/assets/scss/_code.scss | Removed unused .copy-icon styling tied to the deleted legacy script. |
| docs/assets/scss/_styles_project.scss | Added styling override to keep the built-in copy button visible on dark code blocks. |
Comments suppressed due to low confidence (1)
docs/layouts/partials/hooks/body-end.html:8
- This partial is described as “intentionally empty”, but it currently emits blank lines (whitespace) after the Hugo comment. If the goal is to ensure the body-end hook produces zero output, use Hugo’s whitespace-trimming delimiters and remove trailing blank lines.
{{/*
Docsy "body-end" hook: markup injected just before </body>.
Intentionally empty. Analytics (Microsoft Clarity) is loaded from the
"head-end.html" hook, and code-block copy buttons are provided by Docsy's
built-in click-to-copy feature, so no scripts are needed here.
*/}}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Reshrahim
approved these changes
Jul 22, 2026
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.
Fix code-block copy button and remove broken clarity.js reference
Fixes #1954
Fixes #1953
Summary
This PR fixes two related front-end bugs in the docs body/footer scripts:
clarity.js404 in the console (Docs body is trying to load clarity.js but it doesn't exist #1953)#1954 – Copy code button
Problem: A legacy custom script (
copy-code-button.js) injected a copy iconinto every code block. Its accompanying CSS was never actually imported, so on
hover the icon rendered inline (pushing the block down) and collided with Docsy's
built-in click-to-copy button, causing misalignment and a flashing "Copy to
clipboard" tooltip. After removing that script, a second issue surfaced: the
native Docsy button uses a dark color (
--bs-tertiary-color), which is nearlyinvisible against the dark Monokai code-block background until hovered.
Fix:
copy-code-button.jsand its<script>tag, relying onDocsy's built-in click-to-copy button.
.copy-iconrules from_code.scss.visible in the top-right corner of every code block at all times.
#1953 – clarity.js 404
Problem:
body-end.htmlreferenced/js/clarity.js, which does not exist inthe repo, producing a
404in the browser console on every page.Fix:
<script src="/js/clarity.js">reference. Microsoft Clarityanalytics is unaffected — it is already loaded via the official Clarity snippet
in
head-end.html.body-end.htmlis intentionally empty.Changes
docs/layouts/partials/hooks/body-end.html– removed both stale scripts; added explanatory commentdocs/static/js/copy-code-button.js– deleteddocs/assets/scss/_code.scss– removed unused.copy-iconrulesdocs/assets/scss/_styles_project.scss– light-color override for the native copy buttonTesting
hugo --gc --minify) — succeeds with no errors.hugo serveron/quick-start/:clarity.js404 in the browser console; Clarity still loads fromhead-end.html.