Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
@import "@triliumnext/ckeditor5/src/theme/headings.css";
@import "@triliumnext/ckeditor5/src/theme/reference_links.css";
/* The app's text is 1.1em of the 16px base, as `style.css` sets `--ck-content-font-size`. */
:root {
--ck-content-font-family: inherit !important;
--ck-content-font-size: 1.1em !important;
--ck-content-font-color: inherit !important;
--ck-content-line-height: inherit !important;
}
/* The app's note title is 180% of the 16px base (`note_title.css`), whatever the content's size. */
#content #title {
margin: 0 0 0.5em;
font-size: 1.8rem;
font-weight: 300;
line-height: 1.2;
color: var(--text-heading);
border-bottom: 1px solid var(--main-border-color);
}
iframe.pdf-view {
width: 100%;
height: 800px;
}
/* The inline code of the app, `style.css`. */
.ck-content code:not(pre code) {
padding: 0.1em 0.35em;
border-radius: 5px;
background-color: var(--inline-code-background-color);
font-size: 0.8em;
overflow-wrap: break-word;
}
/* The code blocks of the app's default theme, `theme-next/notes/text.css`. `:root` outranks
`ckeditor5-content.css`, which `index.ts` imports after this file. */
:root .ck-content pre {
position: relative;
min-width: unset;
margin-top: 2px;
border: 0;
border-radius: 6px;
padding: 1em;
color: var(--text-primary);
background-color: var(--background-secondary);
box-shadow: var(--code-block-box-shadow);
white-space: pre;
}
:root .ck-content pre:has(> code) {
padding: 0;
}
:root .ck-content pre code {
display: block;
padding: var(--code-block-padding, 1em);
overflow: auto;
}
:root .ck-content td pre {
--code-block-padding: 0.5em;
white-space: pre-wrap;
overflow-wrap: break-word;
}
.ck-content pre:has(> .copy-button) {
position: relative;
& > code {
padding-inline-end: 3em;
}
}
.ck-content pre > .copy-button {
position: absolute;
top: calc(var(--code-block-padding, 1em) / 2);
inset-inline-end: calc(var(--code-block-padding, 1em) / 2);
display: flex;
align-items: center;
justify-content: center;
width: 2em;
height: 2em;
border: 0;
border-radius: 6px;
padding: 0;
background: transparent;
color: var(--text-menu);
font-size: 1rem;
cursor: pointer;
opacity: 0;
transition: opacity 150ms ease;
& > .tn-icon {
font-size: 1.25em;
}
&:hover {
background: var(--background-highlight);
color: var(--text-primary);
}
}
.ck-content pre:hover > .copy-button,
.ck-content pre > .copy-button:focus-visible,
.ck-content pre > .copy-button.copied {
opacity: 1;
}
@media (hover: none) {
.ck-content pre > .copy-button {
opacity: 0.6;
}
}
/* The heading weight of the app's default theme (`theme-next/notes/text.css`), and the sizes and
default `headingStyle`, "underline", of its read-only text (`ReadOnlyText.css`). */
.ck-content :is(h1, h2, h3, h4, h5, h6) {
font-weight: 300;
}
.ck-content :is(h1, h2, h3, h4:not(.include-note-title), h5, h6) {
border-bottom: 1px solid var(--main-border-color);
}
.ck-content {
h1 { font-size: 1.8em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.4em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1.1em; }
h6 { font-size: 1em; }
}
.ck-content strong {
font-weight: 600;
}
/* The block spacing of Bootstrap's reboot, which the app loads. */
.ck-content :where(p, ul, ol, pre, blockquote, table) {
margin-top: 0;
}
.ck-content :where(p, ul, ol, pre, blockquote) {
margin-bottom: 1rem;
}
.ck-content :where(ul, ol) {
padding-inline-start: 2rem;
}
.ck-content :where(ul, ol) :where(ul, ol) {
margin-bottom: 0;
}
.ck-content mark {
padding: 0.1875em;
background-color: #fff3cd;
color: #212529;
}
::selection {
background-color: var(--selection-background-color);
}
/* The blockquotes of the app's default theme, `theme-next/notes/text.css`. */
:root .ck-content blockquote {
position: relative;
margin: 0 0 1rem;
border: 1px solid transparent !important;
border-radius: 10px;
padding: 1em 2.5em;
background: var(--card-background-color);
font-style: normal;
}
.ck-content blockquote p:last-of-type {
margin-bottom: 0;
}
.ck-content blockquote::before,
.ck-content blockquote::after {
position: absolute;
top: 0;
font-size: 48px;
opacity: 0.1;
}
.ck-content blockquote::before {
content: "“";
inset-inline-start: 0.2em;
}
.ck-content blockquote::after {
content: "”";
inset-inline-end: 0.35em;
}
:root .ck-content hr {
margin-block: 5px;
height: 0;
border: thin solid var(--main-border-color);
background: none;
opacity: 1;
}
/* The keyboard shortcuts of the app's default theme, `theme-next/dialogs.css`. */
.ck-content kbd {
display: inline-block;
margin: 0 2px 2px;
border: 1px solid var(--kbd-border);
border-radius: 5px;
padding: 2px 8px;
background: var(--kbd-background);
box-shadow:
0 2px 0 var(--kbd-border),
inset 0 -1px 0 var(--kbd-border);
color: var(--kbd-color);
font-family: inherit;
font-size: 0.75em;
font-weight: normal;
line-height: 1.4;
letter-spacing: 0.5pt;
vertical-align: 1px;
white-space: nowrap;
}
:root .ck-content .table table:not(.layout-table) th {
background-color: var(--accented-background-color);
}
:root .ck-content :is(.table, .image) > figcaption {
background-color: var(--accented-background-color);
color: var(--text-primary);
}
/* The links of the app's default theme, `theme-next/forms.css`; link previews and heading links have their own. */
.ck-content a:where(:not(.link-embed-mention, .link-embed-card, .toc-anchor)) {
--background: transparent;
box-shadow: 0 0 0 0 var(--background);
border-radius: 4px;
background: var(--background);
font-weight: 500;
text-decoration: none;
transition:
background-color 200ms ease-out,
box-shadow 200ms ease-out,
color 300ms ease-out;
}
.ck-content a:where(:not(.link-embed-mention, .link-embed-card, .toc-anchor)):focus-visible {
outline: 2px solid var(--link-focus-outline-color);
outline-offset: 2px;
}
.ck-content a:where(:not(.link-embed-mention, .link-embed-card, .toc-anchor)):hover {
--background: var(--link-hover-background);
box-shadow: 0 0 0 4px var(--link-hover-background);
text-decoration: underline;
transition:
background-color 100ms ease-in,
box-shadow 100ms ease-in,
color 150ms ease-in;
}
#content img {
max-width: 100%;
height: auto;
}
body:not(.math-loaded) .math-tex {
visibility: hidden;
}
/* The tables of the app, which draws them with `ckeditor5-content.css`: Bootstrap's `.table` class
stretches the `<figure>` to the content's width, and `style.css` centers the cells vertically. A
resized table keeps the width the figure carries in its `style`. */
.ck-content figure.table {
width: 100%;
}
.ck-content .table :is(td, th) {
vertical-align: middle;
}
/* Spreadsheet (Univer) tables are emitted as a static <table> whose cells carry their
own inline borders/fills. They live under #content.type-spreadsheet, not .ck-content,
so the rule above does not reach them. Collapse the borders so adjacent cell borders
merge into single lines instead of doubling across the default border-spacing gaps. */
.spreadsheet-table {
border-collapse: collapse;
/* The gridline color, for the sheets that enable gridlines; the rule drawing them is emitted
by the renderer, and a sheet carrying its own color overrides this on the table element.
Borders collapse, so adjacent cells' gridlines merge into single 1px lines (no doubling).
A real data border at the same 1px width ties the gridline under collapse and wins by
source order, so heavier (>=2px) and filled-cell borders always show; an unfilled cell's
own 1px border may cede its top/left edge to a neighbour's gridline — fine for a faint grid. */
--spreadsheet-gridline-color: var(--background-highlight);
width: auto;
margin-top: 1em;
/* Honour the per-column widths emitted in the colgroup (and the explicit table width) so the
grid keeps the editor's geometry. Without this, a cell wider than its column would stretch
the column and break the alignment of the absolutely-positioned floating images. */
table-layout: fixed;
}
/* The context is in :where() so this stays a default: the renderer emits the commonest cell
style as a `.spreadsheet-table td` rule, which has to win over it. */
:where(.spreadsheet-table) td {
padding: 2px 4px;
/* Match the spreadsheet: long text overflows into empty neighbouring cells rather than
wrapping, which keeps every row at its declared height. Wrapping would grow rows and push
the floating images (positioned in absolute px) out of alignment with the grid. */
white-space: nowrap;
overflow: visible;
}
/* A sheet that has floating images is wrapped in a positioned container; the images are emitted as
absolutely-positioned <img> with inline left/top/width/height in the grid's content coordinates
(the Univer transform, with the row/column header sizes removed). */
.spreadsheet-sheet {
position: relative;
font-size: 11pt;
line-height: 1.2;
/* Carry the table's top spacing on the wrapper so the table's top edge sits exactly at the
wrapper origin — the images are positioned absolutely from there, so any table margin would
shift them vertically out of alignment with the grid. */
margin-top: 1em;
}
.spreadsheet-sheet .spreadsheet-table {
margin-top: 0;
}
/* Images embedded inside a cell flow with the cell content. */
.spreadsheet-cell-image {
display: block;
max-width: 100%;
object-fit: contain;
}
/* An include, or the video of a link preview, placed and sized as the editor saved it. */
.ck-content :is(
figure.include-note, figure.captioned-content-embed,
section.link-embed:where([data-embed-type="youtube"])
) {
clear: both;
margin: 1em 0;
&:is(
[data-box-size="small"], [data-box-size="medium"], [data-box-size="expandable"],
.link-embed, .captioned-content-embed
) {
margin-inline: auto;
max-width: 100%;
width: var(--include-note-width, auto);
}
&:is(.link-embed, :has(> .link-embed))[data-box-size="full"] {
max-width: min(100%, 70vh * var(--video-aspect-ratio, 16 / 9));
}
&[data-position="left"] {
margin-right: auto;
margin-left: 0;
}
&[data-position="right"] {
margin-right: 0;
margin-left: auto;
}
&:is([data-position="wrap-left"], [data-position="wrap-right"]) {
--_include-note-wrap-gap: clamp(0px, 100% - var(--include-note-width, 100%),
var(--ck-content-image-style-spacing, 1.5em));
clear: none;
margin-top: 0;
max-width: 100%;
width: var(--include-note-width, 100%);
}
&[data-position="wrap-left"] {
float: left;
margin-right: var(--_include-note-wrap-gap);
}
&[data-position="wrap-right"] {
float: right;
margin-left: var(--_include-note-wrap-gap);
}
}
.ck-content figure.captioned-content-embed > section.link-embed {
margin: 0;
width: auto;
}
@media (max-width: 48em) {
.ck-content :is(
figure.include-note, figure.captioned-content-embed, section.link-embed
)[data-position] {
float: none;
clear: both;
margin: 1em 0;
width: auto;
}
}
.ck-content :is(.include-note, .captioned-content-embed) > figcaption {
margin-top: .5em;
border-top: 1px solid var(--background-active);
padding-top: .5em;
font-size: .9em;
text-align: center;
}
.ck-content .include-note-unavailable {
margin-block: 1em;
border: 1px solid var(--background-active);
border-radius: 10px;
padding-block: 4em;
text-align: center;
}
.ck-content .trilium-tabs {
--card-background-color: var(--background-secondary);
--main-text-color: var(--text-primary);
--tabs-title-max-width: 100cqi;
& .trilium-tabs-bar .trilium-tab-title {
text-overflow: ellipsis;
}
/* Translucent, like the app's `--card-background-color`, so each level stacks a shade. */
& .trilium-tabs {
--card-background-color: color-mix(in srgb, var(--text-primary) 5%, transparent);
}
}