waveterm/frontend/app/element/markdown.scss
Evan Simkowitz 2e91ee843c
Switch from Less to Scss (#1335)
Less hasn't received an update in over a year and the parser is missing
some modern syntax like relative colors so this switches us to scss
2024-11-21 16:05:04 -08:00

212 lines
5.3 KiB
SCSS

// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
.markdown {
display: flex;
flex-direction: row;
overflow: hidden;
height: 100%;
width: 100%;
.content {
height: 100%;
width: 100%;
overflow: scroll;
line-height: 1.5;
color: var(--main-text-color);
font-family: var(--markdown-font);
font-size: 14px;
overflow-wrap: break-word;
&.non-scrollable {
overflow: hidden;
}
.heading {
&:first-of-type {
margin-top: 0 !important;
}
color: var(--main-text-color);
margin-top: 16px;
margin-bottom: 8px;
}
strong {
color: var(--main-text-color);
}
a {
color: #32afff;
}
ul {
list-style-type: disc;
list-style-position: outside;
margin-left: 16px;
}
ol {
list-style-position: outside;
margin-left: 19px;
}
blockquote {
margin: 4px 10px 4px 10px;
border-radius: 3px;
background-color: var(--panel-bg-color);
padding: 2px 4px 2px 6px;
}
pre.codeblock {
background-color: var(--panel-bg-color);
margin: 4px 10px;
padding: 0.4em 0.7em;
border-radius: 4px;
position: relative;
code {
line-height: 1.5;
white-space: pre-wrap;
word-wrap: break-word;
overflow: auto;
overflow: hidden;
background-color: transparent;
}
.codeblock-actions {
visibility: hidden;
display: flex;
position: absolute;
top: 0;
right: 0;
border-radius: 4px;
backdrop-filter: blur(8px);
margin: 2px 2px;
padding: 4px 4px;
align-items: center;
justify-content: flex-end;
gap: 4px;
}
&:hover .codeblock-actions {
visibility: visible;
}
}
code {
color: var(--main-text-color);
font: var(--fixed-font);
border-radius: 4px;
}
pre.selected {
outline: 2px solid var(--accent-color);
}
.heading {
font-weight: semibold;
padding-top: 6px;
}
.heading.is-1 {
border-bottom: 1px solid var(--border-color);
padding-bottom: 6px;
font-size: 2em;
}
.heading.is-2 {
border-bottom: 1px solid var(--border-color);
padding-bottom: 6px;
font-size: 1.5em;
}
.heading.is-3 {
font-size: 1.25em;
}
.heading.is-4 {
font-size: 1em;
}
.heading.is-5 {
font-size: 0.875em;
}
.heading.is-6 {
font-size: 0.85em;
}
.waveblock {
margin: 16px 0;
.wave-block-content {
display: flex;
align-items: center;
padding: 12px;
background-color: var(--highlight-bg-color);
border: 1px solid var(--border-color);
border-radius: 8px;
transition: background-color 0.2s ease;
}
.wave-block-icon {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background-color: black;
border-radius: 8px;
margin-right: 12px;
}
.wave-block-icon i {
font-size: 18px;
color: var(--secondary-text-color);
}
.wave-block-info {
display: flex;
flex-direction: column;
}
.wave-block-filename {
font-size: 14px;
font-weight: 500;
color: var(--main-text-color);
}
.wave-block-size {
font-size: 12px;
color: var(--secondary-text-color);
}
}
}
// The TOC view should scroll independently of the contents view.
.toc {
max-width: 40%;
height: 100%;
overflow: scroll;
border-left: 1px solid var(--border-color);
.toc-inner {
height: fit-content;
position: sticky;
top: 0;
display: flex;
flex-direction: column;
gap: 5px;
text-wrap: wrap;
h4 {
padding-left: 5px;
}
.toc-item {
cursor: pointer;
--indent-factor: 1;
// The 5px offset in the padding will ensure that when the text in the item wraps, it indents slightly.
// The indent factor is set in the React code and denotes the depth of the item in the TOC tree.
padding-left: calc((var(--indent-factor) - 1) * 10px + 5px);
text-indent: -5px;
}
}
}
}