Files
fizzy/app/assets/stylesheets/rich-text-content.css
T
2025-05-23 13:25:07 +02:00

237 lines
5.0 KiB
CSS

@layer components {
.rich-text-content {
:where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) {
font-weight: 800;
hyphens: auto;
letter-spacing: -0.02ch;
line-height: 1.1;
margin-block: 0;
overflow-wrap: break-word;
text-wrap: balance;
}
:where(h1, h2, h3, h4, h5, h6) { display: block; }
:where(h1, h2, h3, h4, h5, h6) { margin-block: 0.65em; }
:is(h1, .h1) { font-size: 2em; }
:is(h2, .h2) { font-size: 1.5em; }
:is(h3, .h3) { font-size: 1.17em; }
:is(h4, .h4) { font-size: 1em; }
:is(h5, .h5) { font-size: 0.83em; }
:is(h6, .h6) { font-size: 0.67em; }
:where(p, ul, ol, dl, blockquote, pre, figure, table, hr) {
margin-block: 0.65lh;
overflow-wrap: break-word;
text-wrap: pretty;
}
:where(hr) {
border-color: var(--color-ink-medium);
border-style: var(--border-style, solid) none none;
margin: 2lh auto;
}
:where(strong) {
font-weight: 700;
}
:is(pre, code, .pre, .code) {
background-color: var(--color-ink-lightest);
border: 1px solid var(--color-ink-lighter);
border-radius: 0.3em;
font-family: var(--font-mono);
font-size: 0.85em;
}
:is(pre) {
overflow-x: auto;
/* text-wrap: nowrap; */
}
:where(code) {
padding: 0.1em 0.3em;
}
:is(pre, .pre) {
border-radius: 0.5em;
padding: 0.5lh 2ch;
:is(code, .code) {
background-color: transparent;
border: 0;
font-size: 1em;
padding: 0;
}
}
:where(p) {
hyphens: auto;
letter-spacing: -0.005ch;
}
:is(blockquote, .quote) {
font-style: italic;
margin: 1ch 3ch;
border-inline-start: 0.25rem solid var(--color-ink-lighter);
margin-inline: 0;
padding: 0.5rem 1rem;
:is(p) {
hyphens: none;
}
}
:where(table, th, td) {
border: 1px solid var(--color-ink-medium);
}
:where(table) {
border-collapse: collapse;
margin: 1lh 0;
}
:where(th, td) {
padding: 0.2lh 1ch;
text-align: start;
}
:where(th) {
border-block-end-width: 3px;
font-weight: 700;
}
:where(img, video, embed, object) {
max-block-size: 32rem;
/* Links should hug media contained within */
a:has(&) {
display: inline-block;
}
}
figure {
display: inline-block;
position: relative;
block-size: auto;
max-inline-size: 100%;
margin-inline: 0;
width: 100%;
img {
display: block;
max-width: 100%;
margin-inline: auto;
max-inline-size: 100%;
height: auto;
user-select: none;
block-size: auto;
}
}
/* Code */
code[data-language] {
display: block;
white-space: pre;
}
code:not([data-language]) {
background-color: #f5f5f5;
border: 1px solid #e0e0e0;
border-radius: 4px;
}
code[class*="language-"],
pre[class*="language-"] {
background: #f9f9fc;
color: #2d2d2d;
font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 0.95rem;
line-height: 1.6;
direction: ltr;
text-align: left;
white-space: pre;
word-break: break-word;
tab-size: 2;
hyphens: none;
border-radius: 8px;
padding: 1em;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
/* Syntax token colors */
code[data-language] {
/* Keywords and attributes */
.code-token__attr,
.token.atrule,
.token.attr,
.token.keyword {
color: #d73a49;
}
/* Constants, booleans, numbers, properties, tags */
.code-token__property,
.token.boolean,
.token.constant,
.token.deleted,
.token.number,
.token.property,
.token.symbol,
.token.tag {
color: #005cc5;
}
/* Strings, selectors, and built-in constructs */
.code-token__selector,
.token.builtin,
.token.char,
.token.inserted,
.token.selector,
.token.string {
color: #032f62;
}
/* Comments and meta information */
.code-token__comment,
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog {
color: #6a737d;
font-style: italic;
}
/* Operators and symbolic entities */
.code-token__operator,
.token.entity,
.token.operator,
.token.url {
color: #d73a49;
}
/* Functions and class names */
.code-token__function,
.token.class,
.token.class-name,
.token.function {
color: #6f42c1;
}
/* Variables, regex, namespaces, important */
.code-token__variable,
.token.important,
.token.namespace,
.token.regex,
.token.variable {
color: #e36209;
}
/* Punctuation */
.code-token__punctuation,
.token.punctuation {
color: #24292e;
}
}
}
}