feat: Support anchors, use style nesting, use normalize.css
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
David Lapshin 2023-11-16 22:46:21 +03:00
parent 685ae98d11
commit 8488d2cbbb
7 changed files with 517 additions and 142 deletions

View file

@ -1,4 +1,5 @@
+++
insert_anchor_links = "right"
+++
{% crt() %}
@ -70,7 +71,11 @@ stylesheets = [
Additional stylesheets; expects it to be in the `static` directory. If you are using Sass it will be compiled there anyway.
If for some reason overridden class are not respected, try using `!important`. You can import styles from Duckquill using `@use "../themes/duckquill/sass/NEEDED_FILE.scss";`.
If for some reason overridden class are not respected, try using `!important`. You can import styles from Duckquill using:
```scss
@use "../themes/duckquill/sass/NEEDED_FILE.scss";
```
### Primary color

View file

@ -45,14 +45,14 @@ body {
// make focused anchor not get covered by nav,
// and flash it with primary color when jumping to it
:target {
scroll-margin-top: 25vh;
scroll-margin-top: 15vh;
animation: highlight-in-out var(--transition-long);
animation-delay: 1s;
}
@keyframes highlight-in-out {
50% {
color: var(--primary-color);
@keyframes highlight-in-out {
50% {
color: var(--primary-color);
}
}
}
@ -79,17 +79,36 @@ h6 {
margin: 3rem 0 1rem;
font-weight: 600;
line-height: 1.25;
.zola-anchor {
color: inherit;
.bi {
display: none;
visibility: hidden;
color: var(--fg50);
}
}
&:hover .zola-anchor .bi {
display: inline-block;
visibility: visible;
}
}
h1 {
letter-spacing: -0.08rem;
font-weight: 900;
font-size: 2.4rem;
}
h1::after {
content: ".";
color: var(--primary-color);
a {
font-weight: 900;
}
&::after {
content: ".";
color: var(--primary-color);
}
}
h2 {
@ -119,18 +138,18 @@ small {
dl {
padding: 0;
}
dl dt {
padding: 0;
margin-top: 1rem;
font-size: 1rem;
font-weight: bold;
}
dt {
padding: 0;
margin-top: 1rem;
font-size: 1rem;
font-weight: bold;
}
dl dd {
padding: 0;
margin-bottom: 1rem;
dd {
padding: 0;
margin-bottom: 1rem;
}
}
hr {
@ -146,19 +165,19 @@ blockquote {
margin-left: 0;
color: var(--fg50);
border-left: 0.3rem solid var(--primary-color);
}
blockquote > :first-child {
margin-top: 0;
}
> :first-child {
margin-top: 0;
}
blockquote > :last-child {
margin-bottom: 0;
}
> :last-child {
margin-bottom: 0;
}
// make border slightly transparent for nested blockquote
blockquote > blockquote {
border-left: 0.3rem solid var(--primary-color-alpha);
// make border slightly transparent for nested blockquote
> blockquote {
border-left: 0.3rem solid var(--primary-color-alpha);
}
}
abbr {
@ -175,13 +194,13 @@ kbd {
background-color: var(--fg05);
box-shadow: inset 0 -2px 0 var(--fg09), 0 -1px 0 var(--fg09);
cursor: pointer;
}
// small nice thingy, keys can be pressed!
kbd:active {
background-color: var(--fg09);
box-shadow: inset 0 1px 0 var(--fg09);
transform: translateY(2px);
// small nice thingy, keys can be pressed!
&:active {
background-color: var(--fg09);
box-shadow: inset 0 1px 0 var(--fg09);
transform: translateY(2px);
}
}
// CODE
@ -193,18 +212,7 @@ code {
color: var(--red-fg);
}
pre code {
background-color: unset;
border-radius: unset;
color: unset;
padding: unset;
}
// apply monospace font to everything inside <pre>
pre * {
font-family: "JetBrains Mono", monospace;
}
// apply monospace font to everything inside the <pre>
pre {
line-height: normal; // unset line height
padding: 1rem;
@ -213,35 +221,46 @@ pre {
max-width: 100vw;
box-shadow: var(--shadow);
overflow: auto;
}
// the line numbers already provide some kind of left/right padding
pre[data-linenos] {
padding: 1rem 0;
}
& * {
font-family: "JetBrains Mono", monospace;
}
pre table td {
padding: 0;
border: none;
}
code {
background-color: unset;
border-radius: unset;
color: unset;
padding: unset;
}
// the line number cells
pre table td:nth-of-type(1) {
text-align: center;
user-select: none;
}
table td {
padding: 0;
border: none;
}
pre mark {
display: block;
background-color: var(--fg05);
color: var(--fg-color); // unset mark color from primary color to text color
border-radius: 0; // unset code block border radius
padding: 0; // unset mark padding
}
// the line number cells
table td:nth-of-type(1) {
text-align: center;
user-select: none;
}
pre table {
width: 100%;
border-collapse: collapse;
mark {
display: block;
background-color: var(--fg05);
color: var(--fg-color); // unset mark color from primary color to text color
border-radius: 0; // unset code block border radius
padding: 0; // unset mark padding
}
table {
width: 100%;
border-collapse: collapse;
}
// the line numbers already provide some kind of left/right padding
&[data-linenos] {
padding: 1rem 0;
}
}
mark {
@ -281,16 +300,16 @@ table {
word-break: normal;
word-break: keep-all; // for Firefox to horizontally scroll wider tables.
-webkit-overflow-scrolling: touch;
}
table th {
font-weight: bold;
}
th {
font-weight: bold;
}
table th,
table td {
padding: 0.5rem 1rem;
border: 1px solid var(--fg05);
th,
td {
padding: 0.5rem 1rem;
border: 1px solid var(--fg05);
}
}
td,
@ -310,17 +329,17 @@ video {
img {
transition: var(--transition-longer);
}
img:not(.no-hover):hover {
transform: scale(125%);
border-radius: 0;
box-shadow: var(--shadow-raised);
}
&:not(.no-hover):hover {
transform: scale(125%);
border-radius: 0;
box-shadow: var(--shadow-raised);
}
@media only screen and (max-device-width: 480px) {
img:not(.no-hover):hover {
transform: scale(110%);
@media only screen and (max-device-width: 480px) {
&:not(.no-hover):hover {
transform: scale(110%);
}
}
}
@ -387,26 +406,26 @@ img:not(.no-hover):hover {
color: var(--primary-color);
}
}
}
@media (min-width: 600px) {
.nav {
&-container {
text-align: left;
}
ul {
bottom: 0;
position: absolute;
right: 0;
@media only screen and (max-device-width: 480px) {
& {
width: 90%;
position: static;
}
}
}
@media only screen and (max-device-width: 480px) {
.nav {
width: 90%;
position: static;
@media (min-width: 600px) {
& {
&-container {
text-align: left;
}
ul {
bottom: 0;
position: absolute;
right: 0;
}
}
}
}
@ -416,9 +435,7 @@ img:not(.no-hover):hover {
padding: 3rem 0 3rem;
font-size: 1rem;
margin-top: 4rem;
}
.footer {
details {
all: unset;
}
@ -475,17 +492,17 @@ img:not(.no-hover):hover {
.cursor {
animation: blicking 1s infinite;
}
@keyframes blicking {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
75% {
opacity: 1;
@keyframes blicking {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
75% {
opacity: 1;
}
}
}
@ -507,21 +524,21 @@ img:not(.no-hover):hover {
ul {
margin: 0;
}
}
.archive {
background-color: var(--purple-bg);
color: var(--purple-fg);
}
&.archive {
background-color: var(--purple-bg);
color: var(--purple-fg);
}
.disclaimer {
background-color: var(--red-bg);
color: var(--red-fg);
}
&.disclaimer {
background-color: var(--red-bg);
color: var(--red-fg);
}
.trigger {
background-color: var(--yellow-bg);
color: var(--yellow-fg);
&.trigger {
background-color: var(--yellow-bg);
color: var(--yellow-fg);
}
}
.johnvertisement {

349
sass/_normalize.scss Normal file
View file

@ -0,0 +1,349 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

View file

@ -1,3 +1,5 @@
/*! scanlines.scss | MIT License | https://codepen.io/meduzen/pen/zxbwRV */
// REGULAR SCANLINES SETTINGS
// width of 1 scanline (min.: 1px)
@ -45,7 +47,7 @@ $scan-opacity: 0.75;
} @else {
animation: none;
}
@media (prefers-reduced-motion) {
@media (prefers-reduced-motion) {
animation: none;
}
}

View file

@ -1,14 +1,14 @@
/*
/*!
* Duckquill v1.0.0 (https://duckquill.exozy.me)
* Copyright 2023 David "Daudix" Lapshin
* Licensed under MIT (https://git.exozy.me/daudix/duckquill/src/branch/main/LICENSE)
*
* Based on OS Component Website which shamelessly stole CSS from systemd
* https://github.com/jimmac/os-component-website
* https://github.com/systemd/systemd/tree/main/docs
*/
Duckquill
====================
based on OS Component Website which shamelessly stolen CSS from systemd
https://github.com/jimmac/os-component-website
https://github.com/systemd/systemd/tree/main/docs
scanlines.scss are taken from https://codepen.io/meduzen/pen/zxbwRV
*/
@use "normalize";
@use "variables";
@use "gnome-hig";
@ -17,5 +17,6 @@
@use "comments";
@use "scanlines";
@use "bootstrap-icons";
@import "syntax-theme-dark.css" (prefers-color-scheme: dark);
@import "syntax-theme-light.css" (prefers-color-scheme: light);
@import url("syntax-theme-dark.css") (prefers-color-scheme: dark);
@import url("syntax-theme-light.css") (prefers-color-scheme: light);

View file

@ -0,0 +1 @@
<a class="zola-anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}"><i class="bi bi-link-45deg"></i></a>