fix(export): emit one CSS class per keyword for independent colouring
CI / cargo fmt --check (push) Successful in 22s
CI / cargo clippy (push) Successful in 39s
CI / cargo test (push) Successful in 30s
CI / editor keymaps (push) Successful in 1m17s

All keywords previously shared `class="todo"`, so a stylesheet couldn't
distinguish e.g. red TODO from green DONE. Emit a distinct class per keyword
(todo/done/started/fixme/fixed/xxx); TODO keeps the vimwiki `todo` class so
stock vimwiki CSS still styles it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 21:43:11 -03:00
parent 9a751037ce
commit e0f97a5caf
2 changed files with 23 additions and 8 deletions
+9 -6
View File
@@ -492,13 +492,16 @@ impl HtmlRenderer {
}
fn render_keyword(&self, n: &KeywordNode, w: &mut dyn Write) -> io::Result<()> {
// One class per keyword so stylesheets can colour them independently
// (e.g. red TODO/FIXME/XXX vs green DONE/FIXED/STARTED). TODO keeps the
// vimwiki `todo` class so stock vimwiki CSS still styles it.
let (label, class) = match n.keyword {
Keyword::Todo => ("TODO", "keyword keyword-todo"),
Keyword::Done => ("DONE", "keyword keyword-done"),
Keyword::Started => ("STARTED", "keyword keyword-started"),
Keyword::Fixme => ("FIXME", "keyword keyword-fixme"),
Keyword::Fixed => ("FIXED", "keyword keyword-fixed"),
Keyword::Xxx => ("XXX", "keyword keyword-xxx"),
Keyword::Todo => ("TODO", "todo"),
Keyword::Done => ("DONE", "done"),
Keyword::Started => ("STARTED", "started"),
Keyword::Fixme => ("FIXME", "fixme"),
Keyword::Fixed => ("FIXED", "fixed"),
Keyword::Xxx => ("XXX", "xxx"),
};
write!(w, "<span class=\"{class}\">{label}</span>")
}