Skip to content

Commit 83a4ae2

Browse files
dgnicholsonDiab Neiroukh
authored andcommitted
Style footnotes and fix hr spacing
Modified to support jakewies#159 and jakewies#160. Co-authored-by: Diab Neiroukh <[email protected]>
1 parent 941a95b commit 83a4ae2

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

assets/scss/pages/post.scss

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,87 @@ main {
288288
mark {
289289
background-color: #ffee58;
290290
}
291+
292+
/* footnote customization */
293+
294+
// Footnote ([1])
295+
.footnote-ref {
296+
text-decoration: none;
297+
color: $primary !important;
298+
font-family: "monospace";
299+
border-radius: 3px;
300+
font-size: 0.75rem;
301+
margin-left: 0.2rem;
302+
&:hover {
303+
background: lighten($primary, 38%);
304+
}
305+
&::before {
306+
content: "[";
307+
}
308+
&::after {
309+
content: "]";
310+
}
311+
}
312+
313+
// Return to footnote (↩︎)
314+
.footnote-backref {
315+
text-decoration: none;
316+
color: $primary !important;
317+
border-radius: 3px;
318+
padding: 0rem 0.2rem 0rem 0.2rem;
319+
font-size: 0.85rem;
320+
margin-left: 0.2rem;
321+
&:hover {
322+
background: lighten($primary, 38%);
323+
}
324+
}
325+
326+
// Line separating post content from the footnotes at the bottom
327+
328+
.footnotes {
329+
> hr {
330+
color: $darkGrey;
331+
@media (prefers-color-scheme: dark) {
332+
color: $lightGrey;
333+
}
334+
border-top: 1px;
335+
margin: 1rem 0;
336+
}
337+
}
338+
339+
// Footnote highlighting
340+
341+
@keyframes footnote_highlight {
342+
0% {
343+
opacity: 0.55;
344+
}
345+
100% {
346+
opacity: 0.05;
347+
}
348+
}
349+
350+
.footnotes li,
351+
.footnote-backref {
352+
position: relative;
353+
354+
&::after {
355+
position: absolute;
356+
z-index: -1;
357+
content: "";
358+
top: 0;
359+
left: 0;
360+
right: 0;
361+
bottom: 0;
362+
background: $primary;
363+
opacity: 0;
364+
border-radius: 0px;
365+
}
366+
367+
&:target,
368+
&:focus {
369+
&::after {
370+
animation: footnote_highlight ease 2s;
371+
opacity: 0.05;
372+
}
373+
}
374+
}

exampleSite/content/blog/markdown-syntax.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ The blockquote element represents content that is quoted from another source, op
4646
4747
[^1]: The above quote is often attributed to Leonardo da Vinci but there is no concrete evidence to support this.
4848

49+
## Footnotes
50+
51+
Both simple footnotes[^2] and longer footnotes[^longnote] are supported.
52+
53+
[^2]: This is a simple footnote.
54+
55+
[^longnote]: This is a longer footnote with multiple paragraphs.
56+
57+
Include paragraphs into the footnote by indenting them. Include as many paragraphs as are needed.
4958

5059
## Tables
5160

0 commit comments

Comments
 (0)