mat.services/sass/style/parts/_code.scss

107 lines
2.0 KiB
SCSS

code {
background-color: var(--bg-1);
padding: 0.1em 0.2em;
border-radius: 5px;
border: 1px solid var(--border-color);
}
pre {
/* Rounded border */
border-radius: 5px;
border: 1px solid var(--border-color);
line-height: 1.4;
overflow-x: auto;
padding: 1em;
}
pre code {
background-color: transparent;
color: inherit;
font-size: 100%;
padding: 0;
// We only want a border around `code` and not `pre code` blocks.
border: 0;
}
pre {
font-family: var(--code-font);
position: relative;
}
pre code[class*="language-"]::before {
background: black;
border-radius: 0 0 0.25rem 0.25rem;
color: white;
font-size: 12px;
letter-spacing: 0.025rem;
padding: 0.1rem 0.5rem;
position: absolute;
right: 0.1rem;
margin-top: 0.1rem;
text-align: right;
text-transform: uppercase;
top: 0;
}
pre code[class="language-javaScript"]::before,
pre code[class="language-js"]::before {
content: "js";
background: #f7df1e;
color: black;
}
pre code[class*="language-yml"]::before,
pre code[class*="language-yaml"]::before {
content: "yaml";
background: #f71e6a;
color: white;
}
pre code[class*="language-shell"]::before,
pre code[class*="language-bash"]::before,
pre code[class*="language-sh"]::before {
content: "shell";
background: green;
color: white;
}
pre code[class*="language-json"]::before {
content: "json";
background: dodgerblue;
color: #000000;
}
pre code[class*="language-python"]::before,
pre code[class*="language-py"]::before {
content: "py";
background: blue;
color: yellow;
}
pre code[class*="language-css"]::before {
content: "css";
background: cyan;
color: black;
}
pre code[class*="language-go"]::before {
content: "Go";
background: cyan;
color: royalblue;
}
pre code[class*="language-md"]::before,
pre code[class*="language-md"]::before {
content: "Markdown";
background: royalblue;
color: whitesmoke;
}
pre code[class*="language-rust"]::before,
pre code[class*="language-rs"]::before {
content: "rust";
background: #fff8f6;
color: #ff4647;
}