Adds spoilers support

This commit is contained in:
Mylloon 2025-05-06 16:28:22 +02:00
parent a44637b9e6
commit 0f3fff0975
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 22 additions and 0 deletions

View file

@ -69,6 +69,7 @@ pub fn get_options(path: Option<FilePath>, metadata_type: MType) -> ComrakOption
.math_dollars(true)
.underline(true)
.subscript(true)
.spoiler(true)
.maybe_link_url_rewriter(match metadata_type {
MType::Cours => Some(Arc::new(move |url: &str| {
// Exclude external links

View file

@ -284,6 +284,21 @@ table:not(.hljs-ln) tr th:last-child {
border-right: 0;
}
/* Spoilers */
.spoiler {
background-color: var(--font-color);
color: transparent;
border-radius: 3px;
cursor: pointer;
transition: all 0.3s ease;
}
.spoiler:hover,
.spoiler:focus {
background-color: var(--background);
color: var(--font-color);
}
@media print {
/* Better colors for paper */
blockquote {
@ -328,6 +343,12 @@ table:not(.hljs-ln) tr th:last-child {
visibility: hidden;
}
/* Reveals all spoilers */
.spoiler {
background-color: var(--background);
color: var(--font-color);
}
@page {
@bottom-right {
content: counter(page) "/" counter(pages);