feat: add copy button functionality to code blocks and update styles - #915
feat: add copy button functionality to code blocks and update styles#915ssimpson89 wants to merge 1 commit into
Conversation
Signed-off-by: Stephen Simpson <ssimpson89@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Dark-theme CSS selectors for the new copybutton/tooltip rules are currently broader than the light-theme base rules, creating avoidable risk of unintended global styling side effects.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enhances the Ascender Sphinx doc site by enabling “copy to clipboard” buttons on rendered code blocks via sphinx-copybutton, updates theme CSS to style the new UI in both light and dark modes, and normalizes several shell examples to avoid embedding host-specific prompts in documentation.
Changes:
- Add and configure the
sphinx-copybuttonSphinx extension, including prompt stripping and line-continuation handling for shell examples. - Add light/dark theme CSS rules for the copy button and tooltip, plus layout padding to prevent wrapped code from flowing under the button.
- Update selected RST code samples to use consistent
$prompts and cleaner literal/code-block formatting.
File summaries
| File | Description |
|---|---|
| docs/docsite/sphinx_ascender_theme/static/css/dark.css | Adds dark-mode overrides for copy button/tooltip styling. |
| docs/docsite/sphinx_ascender_theme/static/css/ansible.css | Adds base copybutton styling plus padding to prevent pre-wrap overlap. |
| docs/docsite/rst/userguide/job_templates.rst | Normalizes a curl example to use $ prompt and consistent indentation. |
| docs/docsite/rst/administration/kerberos_auth.rst | Removes host-specific root prompts and improves step formatting around kinit/klist. |
| docs/docsite/requirements.txt | Pins sphinx-copybutton in the compiled requirements lock. |
| docs/docsite/requirements.in | Adds sphinx-copybutton to the source requirements list with rationale. |
| docs/docsite/conf.py | Enables sphinx_copybutton and configures prompt/continuation behavior. |
Review details
Suppressed comments (1)
docs/docsite/sphinx_ascender_theme/static/css/dark.css:219
- This tooltip override is missing the
.rst-contentscope used by the base rule inansible.css(.rst-content .o-tooltip--left:after). Without the scope, any.o-tooltip--leftused elsewhere in the page will inherit doc-specific colors in dark mode.
html[data-theme="dark"] .o-tooltip--left:after {
background: var(--asc-surface-raised);
color: var(--asc-text-strong);
border: 1px solid var(--asc-border);
}
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
SUMMARY
This update adds a clipboard button to code blocks to allow for direct copying. It also corrects some code blocks that had terminal info that breaks the standard convention in the docs.
ISSUE TYPE
COMPONENT NAME