Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
8.2 KB
Raw Blame
/*
 * Code typography and lowlight highlighting.
 *
 * The literal-code rules intentionally disable font ligatures for both inline
 * code and code blocks. Command flags such as `--extra` must render as the
 * exact characters the user can copy.
 */

/* Inline code */
.rich-text-editor code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
  font-size: var(--code-font-size, var(--text-body));
  background: var(--code-background, color-mix(in srgb, var(--foreground) 3%, transparent));
  border: 1px solid var(--code-border-color, color-mix(in srgb, var(--foreground) 5%, transparent));
  color: var(--code-color, color-mix(in srgb, var(--foreground) 75%, transparent));
  padding: var(--code-padding, 0.125rem 0.375rem);
  border-radius: var(--code-radius, var(--radius-sm));
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: 2;
}

/* Code blocks */
.rich-text-editor pre,
pre.rich-text-editor {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
  background: var(--code-block-background, var(--muted));
  border: var(--code-block-border, none);
  border-radius: var(--code-block-radius, var(--radius));
  padding: var(--code-block-padding, 0.75rem 1rem);
  margin: 0.75rem 0;
  /* Long lines wrap, matching the editable code block (its NodeViewContent
     sets an inline pre-wrap). Without this, readonly blocks scroll while
     editable blocks wrap and the same document changes shape between the
     two renderers. overflow-x stays as a fallback for unbreakable tokens. */
  white-space: pre-wrap;
  overflow-x: auto;
}

.rich-text-editor pre code,
pre.rich-text-editor code {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
  background: none;
  border: none;
  color: var(--code-block-color, var(--foreground));
  padding: 0;
  font-size: var(--code-block-font-size, var(--text-label));
  line-height: var(--code-block-line-height, 1.6);
}

/* Syntax highlighting — lowlight (hljs). Scoped to the editor surface, to the
   task transcript, which highlights file bodies with the same engine so a
   file reads identically in a comment and in an execution trace, and to the
   attachment viewer's data tree, whose keys and values borrow the same token
   colours as the file's source. */
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-keyword,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-selector-tag,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-built_in { color: var(--code-keyword, oklch(0.55 0.16 255)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-string,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-addition { color: var(--code-string, oklch(0.55 0.14 155)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-comment,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-quote { color: var(--code-comment, var(--muted-foreground)); font-style: italic; }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-number,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-literal { color: var(--code-number, oklch(0.58 0.16 30)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-section,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title\.function_ { color: var(--code-function, oklch(0.55 0.14 280)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-attr,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-attribute { color: var(--code-property, oklch(0.58 0.12 60)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-variable,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-template-variable { color: var(--code-variable, oklch(0.58 0.14 20)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-type,
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title\.class_ { color: var(--code-type, oklch(0.55 0.14 200)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-deletion { color: var(--code-deletion, oklch(0.55 0.2 25)); }

:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-meta { color: var(--muted-foreground); }

/* XML / HTML — lowlight emits .hljs-tag for `<` `>` brackets and .hljs-name
   for the element name. Without these rules, HTML source renders mostly in
   the default text color and looks unhighlighted. */
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-tag { color: var(--code-punctuation, var(--muted-foreground)); }
:is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-name { color: var(--code-tag, oklch(0.55 0.16 255)); }

/* Dark mode overrides */
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-keyword,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-selector-tag,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-built_in { color: var(--code-keyword, oklch(0.7 0.14 255)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-string,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-addition { color: var(--code-string, oklch(0.7 0.14 155)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-number,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-literal { color: var(--code-number, oklch(0.72 0.14 30)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-section,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title\.function_ { color: var(--code-function, oklch(0.72 0.12 280)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-attr,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-attribute { color: var(--code-property, oklch(0.72 0.1 60)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-variable,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-template-variable { color: var(--code-variable, oklch(0.72 0.12 20)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-type,
.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-title\.class_ { color: var(--code-type, oklch(0.72 0.12 200)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-deletion { color: var(--code-deletion, oklch(0.7 0.18 25)); }

.dark :is(.rich-text-editor, .transcript-code, .structured-tree) .hljs-name { color: var(--code-tag, oklch(0.72 0.14 255)); }

/* Numbered lines — CodeBlockStatic with `lineNumbers` (the attachment viewer's
   code, text and log files). A whole document rather than a block inside
   prose: no margin, no rounded panel, just the page it sits on. Each line is a
   flex row: a gutter pseudo-element carrying `data-line`, then the code. Lines
   keep their shape and the block scrolls sideways; `.code-lines-wrap` wraps
   them under their own number instead. The gutter is sticky so numbers stay
   in view while scrolling sideways, and opaque so code passing beneath it
   never shows through — a host on another surface sets `--code-gutter-bg`. */
pre.code-lines {
  margin: 0;
  border-radius: 0;
  background: transparent;
  padding: 1rem 0;
  white-space: pre;
}

pre.code-lines code {
  display: block;
  width: max-content;
  min-width: 100%;
}

pre.code-lines.code-lines-wrap code {
  width: auto;
}

pre.code-lines .code-line {
  display: flex;
}

pre.code-lines .code-line::before {
  content: attr(data-line);
  position: sticky;
  left: 0;
  flex: none;
  box-sizing: content-box;
  width: calc(var(--line-digits, 1) * 1ch);
  padding-inline: 1rem 1.25rem;
  text-align: right;
  color: color-mix(in srgb, var(--muted-foreground) 70%, transparent);
  background: var(--code-gutter-bg, var(--background));
  user-select: none;
}

pre.code-lines .code-text {
  flex: 1 0 auto;
  padding-right: 1.5rem;
  white-space: pre;
}

pre.code-lines.code-lines-wrap .code-text {
  flex: 1 1 0;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}