From ee8e2e3acf6230ff782bb02094753a692583002b Mon Sep 17 00:00:00 2001 From: eiiko6 Date: Fri, 20 Mar 2026 13:02:46 +0100 Subject: [PATCH] added css overdide option --- example/bernardo.toml | 16 ++++++++++++++++ src/main.rs | 1 + src/rendering.rs | 1 + templates/_base.html | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/example/bernardo.toml b/example/bernardo.toml index 4972ae0..3415253 100644 --- a/example/bernardo.toml +++ b/example/bernardo.toml @@ -3,6 +3,22 @@ category = "Characters" image = "bernardo.png" content_file = "bernardo.md" +css_override = """ +#content { + background: white; + color: black; + border-radius: var(--radius-md); +} + +.wiki-header h1 { + color: var(--accent); +} + +.wiki-sidebar { + background: white; +} +""" + [infobox] "Espèce" = "Papoute Commun" Genre = "H" diff --git a/src/main.rs b/src/main.rs index 44b3d5b..5a6ee60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,7 @@ pub struct WikiConfig { pub image: Option, pub infobox: Option>, pub content_file: Option, + pub css_override: Option, } struct AppState { diff --git a/src/rendering.rs b/src/rendering.rs index 0d95f59..737dad2 100644 --- a/src/rendering.rs +++ b/src/rendering.rs @@ -220,6 +220,7 @@ pub async fn render_wiki_page( context.insert("next_page", &next); context.insert("no_navigation", &no_navigation); context.insert("is_static", &is_static); + context.insert("css_override", &config.css_override); TEMPLATES .render("page.html", &context) diff --git a/templates/_base.html b/templates/_base.html index 104ffa3..edca2e4 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -10,6 +10,10 @@ {% endblock head %} +{% if css_override %} + +{% endif %} + {% if not no_navigation %}