Skip to content

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

Fix syntax highlighting being stripped by 1Password extension (#291)

Maximilian Roos11a21a2489bf
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scss
index 06d78fd23..f3786bc13 100644
--- a/docs/sass/custom.scss
+++ b/docs/sass/custom.scss
@@ -442,12 +442,17 @@ main {
font-family: var(--wt-font-mono);
font-size: 0.875rem;
line-height: 1.6;
- color: var(--wt-color-text);
+ // Note: color is NOT set here to allow syntax highlighting themes to apply
}
}
.content pre {
@extend %code-block-base;
+
+ // Override .content code color to allow syntax highlighting
+ code {
+ color: inherit;
+ }
}
// Copy button for code blocks
@@ -485,6 +490,7 @@ main {
font-family: var(--wt-font-mono);
font-size: 0.875rem;
line-height: 1.5;
+ color: var(--wt-color-text); // Default text color for terminal (not syntax-highlighted)
.prompt {
color: var(--wt-color-text-soft);
diff --git a/docs/templates/base.html b/docs/templates/base.html
index ba9aac883..3e253f709 100644
--- a/docs/templates/base.html
+++ b/docs/templates/base.html
@@ -85,6 +85,26 @@
<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>