Commit Graph

5 Commits

Author SHA1 Message Date
Maximilian Roos ad0c6ebeb8 fix(docs): prevent code block layout jump on page load (#622)
Move code block wrapper creation from deferred JavaScript to a synchronous
inline script at the end of <body>. This ensures the DOM structure is
finalized before the browser's first paint, eliminating the visible "jump"
when code blocks were wrapped after initial render.

Split into two phases:
1. Inline sync script wraps <pre> in .code-block-wrapper before first paint
2. Deferred code-copy.js adds copy buttons to existing wrappers

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-14 01:50:17 -08:00
Maximilian Roos ba959adbfa Refactor bash detection in code-copy.js
Check data-lang attribute and code content instead of relying on
stripped language classes. Update comment to reflect current detection
logic for bash/shell code blocks.
2026-01-05 16:14:42 -08:00
Maximilian Roos aab859cef4 docs: fix copy button position during horizontal scroll (#415)
Wrap code blocks in a container div so the copy button stays fixed at
the top-right corner when scrolling horizontally. Previously the button
would scroll with the code content.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-04 12:19:52 -08:00
Maximilian Roos 98ce5fbd27 Refactor 1Password extension workaround and update code copy detection 2025-12-30 15:46:10 -08:00
Maximilian Roos 1717529783 Add copy-to-clipboard button for code blocks
Implements a floating copy button that appears on code block hover, with special handling to strip shell prompts from terminal blocks before copying.

New files:
- code-copy.js: Attaches copy buttons to all code blocks, strips leading `$ ` from bash/shell/terminal blocks, shows checkmark feedback for 2 seconds after successful copy

Style updates:
- .code-copy-btn: Positioned absolutely in top-right, hidden by default with opacity transition, styled to match design system colors
- .content pre:hover .code-copy-btn: Reveals button on code block hover
- Button includes copied state with accent color highlight
2025-12-02 22:55:32 -08:00