Added language-specific syntax highlighting support to the markdown editor and preview. New code-highlighter assets are registered for public pages and admin headers. The PostContentRenderer detects language identifiers in code fences to apply appropriate CSS classes for highlighting. Tests verify the highlighting works correctly and unsafe content is escaped properly.
48 lines
663 B
CSS
48 lines
663 B
CSS
.hljs {
|
|
color: var(--color-base-content);
|
|
}
|
|
|
|
.hljs-comment,
|
|
.hljs-quote {
|
|
opacity: 0.7;
|
|
font-style: italic;
|
|
}
|
|
|
|
.hljs-keyword,
|
|
.hljs-selector-tag,
|
|
.hljs-literal,
|
|
.hljs-section {
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.hljs-string,
|
|
.hljs-title,
|
|
.hljs-name,
|
|
.hljs-type,
|
|
.hljs-attribute,
|
|
.hljs-symbol,
|
|
.hljs-bullet,
|
|
.hljs-addition {
|
|
color: var(--color-success);
|
|
}
|
|
|
|
.hljs-number,
|
|
.hljs-regexp,
|
|
.hljs-variable,
|
|
.hljs-template-variable {
|
|
color: var(--color-secondary);
|
|
}
|
|
|
|
.hljs-built_in,
|
|
.hljs-class .hljs-title {
|
|
color: var(--color-info);
|
|
}
|
|
|
|
.hljs-meta,
|
|
.hljs-meta .hljs-keyword {
|
|
color: var(--color-warning);
|
|
}
|
|
|
|
.hljs-deletion {
|
|
color: var(--color-error);
|
|
} |