:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
.Notebook {
display: flex;
flex: 1;
flex-direction: column;
width: 100%;
margin-top: 1rem;
.SidePanel3000 & {
margin-top: 0;
}
.NotebookEditor {
position: relative;
flex: 1;
min-width: 0; // So trends and other insight elements resize properly
margin: 0 auto;
.ProseMirror {
&-focused {
outline: none;
}
> h1,
> h2,
> h3,
> h4 {
position: relative; // For the "collapse" widget's positioning
margin: 0 0 0.5em;
font-weight: 600;
line-height: 1.2;
letter-spacing: -0.01em;
> .ProseMirror-widget {
position: absolute;
top: 50%;
left: 0;
padding-right: 0.375rem;
opacity: 0.5; // Reduced opacity so that this doesn't stand out like a sore thumb
transform: translateY(-50%) translateX(-100%);
&:hover {
opacity: 1;
}
}
&:not(:hover) > .ProseMirror-widget {
opacity: 0;
}
&[data-collapsed='true'] > .ProseMirror-widget {
opacity: 0.8;
}
}
> h1:not(:first-child),
> h2:not(:first-child) {
margin-top: 0.9em;
}
> h3:not(:first-child),
> h4:not(:first-child),
> h5:not(:first-child) {
margin-top: 0.6em;
}
> h1 {
font-size: 1.75rem; // Larger, clean title
color: var(--text-3000);
}
> h2 {
font-size: 1.25rem; // Subheading scale
}
> h3 {
font-size: 1.0625rem;
}
> h4 {
font-size: 0.875rem;
}
> h5 {
position: relative; // For the heading toggle
font-size: 0.875rem;
font-weight: 600;
> .ProseMirror-widget {
position: absolute;
top: 50%;
left: 0;
padding-right: 0.375rem;
opacity: 0.5; // Reduced opacity so that this doesn't stand out like a sore thumb
transform: translateY(-50%) translateX(-100%);
.SidePanel3000 & {
padding-right: 1px;
}
&:hover {
opacity: 1;
}
}
&:not(:hover) > .ProseMirror-widget {
opacity: 0;
}
&[data-collapsed='true'] > .ProseMirror-widget {
opacity: 0.8;
}
}
> p {
margin: 0.8rem 0;
line-height: 1.7;
}
> .is-empty {
position: relative;
}
> .is-empty::before {
color: rgb(0 0 0 / 20%);
[theme='dark'] & {
color: rgb(255 255 255 / 20%);
}
}
> ol {
margin: 0.6rem 0;
list-style-type: decimal;
ol {
margin: 0.3rem 0;
list-style-type: lower-alpha;
}
}
> ul {
padding-left: 1.25rem;
margin: 0.6rem 0;
list-style-type: disc;
ul {
padding-left: 1.1rem;
margin: 0.3rem 0;
list-style-type: circle;
}
}
> ul[data-type='taskList'] {
padding-left: 0;
margin: 0.5rem 0;
list-style-type: none;
li {
display: flex;
> label {
flex: 0 0 auto;
padding: 0.15rem;
margin-top: 0.15rem;
margin-right: 0.5rem;
user-select: none;
border-radius: 6px;
transition:
background 120ms ease-in-out,
border-color 120ms ease-in-out;
}
> div {
flex: 1 1 auto;
}
input[type='checkbox'] {
width: 1rem;
height: 1rem;
accent-color: var(--color-accent);
border-radius: 4px;
transform: translateY(1px);
}
> label:hover {
background: var(--color-bg-surface-primary);
}
ul li,
ol li {
display: list-item;
}
ul[data-type='taskList'] > li {
display: flex;
}
}
}
> ul,
> ol {
padding-left: 1.5rem;
ul,
ol {
padding-left: 1.25rem;
}
li {
margin: 0.35rem 0;
p {
margin: 0.25rem 0;
}
}
}
> pre {
position: relative;
padding: 0.75rem 1rem;
margin: 1rem 0;
overflow-x: auto;
font-family: var(
--font-code,
ui-monospace,
SFMono-Regular,
Menlo,
Monaco,
Consolas,
'Liberation Mono',
'Courier New',
monospace
);
font-size: 0.95em;
line-height: 1.6;
tab-size: 2;
background-color: rgb(0 0 0 / 4%);
border: 1px solid color-mix(in oklab, var(--color-border-primary), transparent 35%);
border-radius: calc(var(--radius) + 4px);
[theme='dark'] & {
background-color: rgb(255 255 255 / 8%);
}
}
> pre[data-language]::before {
position: absolute;
top: 0.35rem;
right: 0.6rem;
font-size: 0.75rem;
color: var(--text-3000);
text-transform: uppercase;
letter-spacing: 0.02em;
content: attr(data-language);
}
> code,
> p code {
padding: 0.2rem 0.3rem;
font-family: var(
--font-code,
ui-monospace,
SFMono-Regular,
Menlo,
Monaco,
Consolas,
'Liberation Mono',
'Courier New',
monospace
);
font-size: 0.95em;
background-color: rgb(0 0 0 / 4%);
border: 1px solid color-mix(in oklab, var(--color-border-primary), transparent 35%);
border-radius: calc(var(--radius) - 2px);
[theme='dark'] & {
background-color: rgb(255 255 255 / 8%);
}
}
// Blockquotes
> blockquote {
padding: 0.6rem 0.9rem;
margin: 1rem 0;
background: color-mix(in oklab, var(--color-bg-surface-primary), transparent 45%);
border-left-width: 3px;
border-radius: var(--radius);
}
> blockquote p {
font-style: italic;
}
// Horizontal rule - match inline table borders
> hr {
margin: 1.25em 0;
border: 0;
border-top: 1px solid color-mix(in oklab, var(--color-border-primary), transparent 35%);
}
// Images
> img,
> figure img {
max-width: 100%;
height: auto;
border-radius: var(--radius);
}
> figure {
margin: 1.1rem 0;
text-align: center;
}
> figcaption {
margin-top: 0.4rem;
font-size: 0.9em;
color: var(--text-3000);
}
// Tables — :not(.NotebookNode *) excludes LemonTable widgets inside notebook nodes
table:not(.NotebookNode *) {
width: 100%;
margin: 1rem 0;
border-spacing: 0;
border-collapse: collapse;
}
table:not(.NotebookNode *) th,
table:not(.NotebookNode *) td {
position: relative;
padding: 0.5rem 0.75rem;
vertical-align: top;
border: 1px solid color-mix(in oklab, var(--color-border-primary), transparent 35%);
}
table:not(.NotebookNode *) th {
font-weight: 600;
text-align: left;
background: var(--color-bg-surface-primary);
}
table:not(.NotebookNode *) tbody tr:nth-child(odd) {
background: color-mix(in oklab, var(--color-bg-surface-primary), transparent 60%);
}
table:not(.NotebookNode *) tbody tr:hover {
background: color-mix(in oklab, var(--color-bg-surface-primary), transparent 30%);
}
// TipTap table cell selection
table:not(.NotebookNode *) .selectedCell {
background: color-mix(in oklab, var(--color-accent), transparent 95%);
}
table:not(.NotebookNode *) p {
margin: 0;
}
// Links
a {
color: var(--color-accent);
text-decoration: underline;
text-underline-offset: 2px;
border-bottom: 0;
&:hover {
text-decoration-thickness: 0.08em;
}
&:visited {
color: var(--text-3000);
}
&:focus-visible {
outline: 2px solid color-mix(in oklab, var(--color-accent), transparent 70%);
outline-offset: 2px;
}
}
// Dividers and heading adjacency spacing
> hr + h2,
> hr + h3 {
margin-top: 0.75rem;
}
> h2 + hr,
> h3 + hr {
margin-top: 0.75rem;
}
// Trim outer whitespace
> :first-child {
margin-top: 0;
}
> :last-child {
margin-bottom: 0;
}
// Page title treatment
> h1:first-child {
margin-top: 0;
font-size: 2rem; // Page title gets extra emphasis
}
[data-collapsed-by] {
display: none; // Node hidden as the heading it's under is collapsed
}
}
.Backlink {
padding: 0.125rem 0.25rem;
background-color: var(--color-bg-surface-primary);
border: 1px solid var(--color-border-primary);
border-radius: var(--radius);
&:hover {
background-color: var(--color-bg-primary);
}
& svg {
color: var(--text-3000);
}
&.Backlink--selected {
border-color: var(--color-accent);
}
&.Backlink--active {
color: var(--white);
background: var(--color-accent);
border: 1px solid var(--color-accent);
& .Backlink__label,
& svg {
color: var(--white);
}
span::selection {
color: var(--white);
}
}
}
&[contenteditable='true'] {
a {
cursor: text;
}
}
}
// Kept at .Notebook level so LaTeX renders the same in the classic editor and markdown v2
.NotebookLatex {
font-size: 1.1em;
line-height: 1.5;
text-align: center;
&[data-display='true'] {
display: block;
margin: 1.5em 0;
font-size: 1.2em;
text-align: center;
}
&[data-display='false'] {
display: inline;
vertical-align: middle;
}
// Style for the MathJax rendered content
.MathJax {
font-size: 1.1em;
}
}
.NotebookLatex mjx-container {
padding: 1em 0;
}
.NotebookLatex mjx-container,
.NotebookLatex svg {
display: block;
margin-right: auto;
margin-left: auto;
}
&--compact:not(.Notebook--canvas) {
.NotebookEditor {
max-width: 50rem;
}
.Notebook__markdown-v2 {
--markdown-notebook-canvas-max-width: 50rem;
}
}
.NotebookColumn {
--notebook-sidebar-height: calc(100vh - 9rem);
position: relative;
width: 0;
transition: width var(--notebook-popover-transition-properties);
.NotebookColumn__content {
position: sticky;
top: 0;
align-self: flex-start;
transition: transform var(--notebook-popover-transition-properties);
transform: translateX(-100%);
}
&--left {
.NotebookColumn__content {
width: var(--notebook-column-left-width);
transform: translateX(-100%);
> .LemonWidget .LemonWidget__content {
max-height: var(--notebook-sidebar-height);
overflow: auto;
}
}
}
&--right {
.NotebookColumn__content {
width: var(--notebook-column-right-width);
transform: translateX(100%);
// Sidebar nodes lost the legacy NotebookNode__gap spacer between them
> * + * {
margin-top: 0.75rem;
}
}
}
&--showing {
&.NotebookColumn--left {
width: var(--notebook-column-left-width);
margin-right: 1rem;
}
&.NotebookColumn--right {
width: var(--notebook-column-right-width);
margin-left: 1rem;
}
.NotebookColumn__content {
transform: translateX(0);
}
}
}
&--editable {
.NotebookEditor .ProseMirror {
flex: 1;
// Add some padding to help clicking below the last element
padding-bottom: 6rem;
}
.Notebook__markdown-v2 .MarkdownNotebook__canvas {
// Generous trailing space so the last cell can scroll up off the bottom edge —
// room to breathe while editing a cell near the end of the notebook.
padding-bottom: max(18rem, 40vh);
}
.NotebookColumn--left.NotebookColumn--showing {
& + .NotebookEditor {
.ProseMirror {
// Add a lot of padding to allow the entire column to always be on screen
padding-bottom: 100vh;
}
}
}
}
.NotebookHistory {
display: flex;
flex: 1;
flex-direction: column;
}
.NotebookInlineMenu {
margin-bottom: -0.2rem;
box-shadow: 0 4px 10px 0 rgb(0 0 0 / 10%);
.LemonInput {
min-height: 0;
border: 0;
}
}
.LemonTable__content > table > thead {
position: sticky;
top: 0;
z-index: 1;
}
.NotebookRecordingTimestamp {
display: inline-flex;
max-height: 22px;
}
.NotebookComment {
padding: 0.1em 0;
margin: 0 -0.05em;
background: color-mix(in oklab, var(--color-accent) 25%, transparent);
border-radius: 2px;
box-decoration-break: clone;
transition: background 120ms ease-in-out;
&:hover {
background: color-mix(in oklab, var(--color-accent) 50%, transparent);
}
&--active,
&--active:hover {
background: color-mix(in oklab, var(--color-accent) 65%, transparent);
}
}
// Overrides for insight controls
.InsightVizDisplay {
.InsightDisplayConfig {
padding: 0;
border-bottom-width: 0;
}
}
}
.Notebook__top-actions {
display: flex;
justify-content: flex-end;
padding: 0 0.75rem;
margin-bottom: 0.75rem;
}
.Notebook_content {
display: flex;
flex: 1;
justify-content: center;
padding: 0 0.75rem;
.SidePanel3000 & {
padding: 0 0.75rem; // Padding to fit in the HeadingToggles
}
}
.Notebook__markdown-v2 {
// Notebook provides its own width constraint; let the canvas fill it. Overriding the
// variable (not the canvas rule) keeps the debug toolbar's right-edge calc in sync,
// so the code icon hugs the first text block's right edge at any viewport width.
--markdown-notebook-canvas-max-width: 100%;
flex: 1;
width: 100%;
min-width: 0;
margin: 0 auto;
}
// `.has-markdown-v2-notebook` is toggled on <body> by Notebook.tsx and stands in for
// `body:has(.Notebook--markdown-v2)`. Do not reintroduce near-root `:has()` anchors here:
// they make Blink flag the whole document as :has-invalidation-suspect, after which any
// class change anywhere costs a full-page style recalc (200ms+ per keystroke on large threads).
body.has-markdown-v2-notebook,
body.has-markdown-v2-notebook .Navigation3000,
body.has-markdown-v2-notebook .main-content-container > main {
--notebook-markdown-v2-page-background: var(--color-bg-primary);
--scene-layout-background: var(--notebook-markdown-v2-page-background);
background: var(--notebook-markdown-v2-page-background);
}
body[theme='dark'].has-markdown-v2-notebook,
body[theme='dark'].has-markdown-v2-notebook .Navigation3000,
body[theme='dark'].has-markdown-v2-notebook .main-content-container > main {
--notebook-markdown-v2-page-background: var(--color-bg-surface-primary);
}
// The Today layout keeps one background on every scene, so a notebook takes the app background there in both themes.
body.has-markdown-v2-notebook .TodayAppLayout .main-content-container > main,
[theme] .TodayAppLayout .Notebook--markdown-v2 {
--notebook-markdown-v2-page-background: var(--color-bg-primary);
}
.Notebook--markdown-v2 {
--notebook-markdown-v2-page-background: var(--color-bg-primary);
background: var(--notebook-markdown-v2-page-background);
[theme='dark'] & {
--notebook-markdown-v2-page-background: var(--color-bg-surface-primary);
}
.Notebook_content,
.Notebook__markdown-v2,
.Notebook__markdown-v2 .MarkdownNotebook__debug-layout,
.Notebook__markdown-v2 .MarkdownNotebook__main,
.Notebook__markdown-v2 .MarkdownNotebook__canvas {
background: var(--notebook-markdown-v2-page-background);
}
.Notebook__markdown-v2.MarkdownNotebook--jupyter .MarkdownNotebook__canvas {
background: var(--jupyter-paper-background);
}
.Notebook__markdown-v2 {
--markdown-notebook-component-background: var(--color-bg-surface-primary);
[theme='dark'] & {
--markdown-notebook-component-background: var(--color-bg-surface-tertiary);
}
}
}
.Notebook--markdown-v2.Notebook--expanded {
.main-content-container > main > & {
width: 100%;
width: var(--scene-layout-rect-width);
max-width: none;
margin-left: -1rem;
}
.Notebook_content {
padding-right: 0;
padding-left: 0;
.Notebook__markdown-v2,
.MarkdownNotebook__debug-layout,
.MarkdownNotebook__main,
.MarkdownNotebook__canvas,
.MarkdownNotebook__canvas-header {
width: 100%;
max-width: none;
}
.SidePanel3000 & {
padding: 0 0.75rem;
}
}
}
.NotebookProfileCanvas {
.Notebook_content {
padding: 0;
}
}
.NotebookPresence__ai-bubble {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
padding: 0;
color: var(--white);
background: var(--notebook-ai-presence-color, var(--color-accent));
border: 0;
border-radius: 50%;
}
// Google-Docs-style remote presence carets + name flag.
.NotebookRemotePresence {
position: relative;
display: inline-block;
width: 0;
height: 1.1em;
margin: 0;
vertical-align: text-bottom;
pointer-events: none;
border-left: 2px solid var(--remote-presence-color, currentColor);
&__flag {
position: absolute;
bottom: 100%;
left: -2px; // aligned with the bar's left edge
z-index: 5;
max-width: 12rem;
padding: 1px 6px;
overflow: hidden;
font-size: 0.7rem;
font-weight: 500;
line-height: 1.2;
color: var(--white);
text-overflow: ellipsis;
white-space: nowrap;
user-select: none;
background: var(--remote-presence-color, currentColor);
border-radius: 3px 3px 3px 0;
}
}