Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Refactor 1Password extension workaround and update code copy detection

Maximilian Roos98ce5fbd27c4
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index afb60c62b..2dc74f44d 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -12,6 +12,12 @@ cd docs && zola serve -p $((10000 + RANDOM))
Check the output for "Web server is available at http://127.0.0.1:<port>" before proceeding.
+For static builds with local URLs (e.g., testing with a simple HTTP server):
+
+```bash
+zola build --base-url "http://127.0.0.1:PORT"
+```
+
### Verifying changes
**Text-only changes** (prose edits, content rewrites): Run pre-commit and provide the dev server link. Playwright verification is not required.
diff --git a/docs/static/code-copy.js b/docs/static/code-copy.js
index b7ee29394..c1699c761 100644
--- a/docs/static/code-copy.js
+++ b/docs/static/code-copy.js
@@ -11,9 +11,11 @@ document.addEventListener('DOMContentLoaded', function() {
button.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>';
button.addEventListener('click', function() {
- // Check if this is a bash/shell code block (has language-bash class on code element)
+ // Check if this is a bash/shell code block
+ // Note: language-* classes are stripped at build time (1Password bug workaround)
+ // so we check for z-source z-shell instead
const codeEl = block.querySelector('code');
- const isBash = codeEl && /language-(bash|sh|shell|zsh)/.test(codeEl.className);
+ const isBash = codeEl && /z-shell|z-bash/.test(codeEl.className);
const isTerminal = block.classList.contains('terminal');
let text = block.textContent;
diff --git a/docs/templates/base.html b/docs/templates/base.html
index 3e253f709..fb46b1ca2 100644
--- a/docs/templates/base.html
+++ b/docs/templates/base.html
@@ -3,6 +3,33 @@
<html lang="en">
<head>
+ <script>
+ // 1Password extension bug workaround: MUST be first script in document.
+ // 1Password injects Prism.js targeting [class*="language-"], stripping our
+ // syntect spans. Fix: rename language-* to lang-* before 1Password sees them.
+ // https://1password.community/discussion/165597
+ (function() {
+ function fix(el) {
+ if (el.className && el.className.replace) {
+ el.className = el.className.replace(/\blanguage-\S*/g, '');
+ }
+ if (el.dataset && el.dataset.lang) el.removeAttribute('data-lang');
+ }
+ new MutationObserver(function(mutations) {
+ for (var i = 0; i < mutations.length; i++) {
+ var nodes = mutations[i].addedNodes;
+ for (var j = 0; j < nodes.length; j++) {
+ var n = nodes[j];
+ if (n.nodeType === 1) {
+ if (n.className && n.className.includes && n.className.includes('language-')) fix(n);
+ var els = n.querySelectorAll ? n.querySelectorAll('[class*="language-"]') : [];
+ for (var k = 0; k < els.length; k++) fix(els[k]);
+ }
+ }
+ }
+ }).observe(document.documentElement, { childList: true, subtree: true });
+ })();
+ </script>
<meta charset="UTF-8">
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
@@ -85,26 +112,6 @@
<script src="/code-copy.js" defer></script>
<script src="/mobile-menu.js" defer></script>
<script src="//instant.page/5.2.0" type="module" integrity="sha384-jnZyxPjiipYXnSU0ygqeac2q7CVYMbh84q0uHVRRxEtvFPiQYbXWUorga2aqZJ0z"></script>
- <script>
- // 1Password extension bug workaround: it strips syntax highlighting spans from
- // code blocks with language-* classes. Adding data-1p-ignore prevents this.
- // https://1password.community/discussion/165597
- (function() {
- var mark = function(el) { el.setAttribute('data-1p-ignore', ''); };
- new MutationObserver(function(mutations) {
- mutations.forEach(function(m) {
- m.addedNodes.forEach(function(n) {
- if (n.nodeType === 1) {
- if (n.matches && n.matches('code[class*="language-"]')) mark(n);
- if (n.querySelectorAll) {
- n.querySelectorAll('code[class*="language-"]').forEach(mark);
- }
- }
- });
- });
- }).observe(document.documentElement, { childList: true, subtree: true });
- })();
- </script>
</head>
<body>