Contributing to katha
Thanks for your interest in improving katha.
Development
katha is a single Rust crate (a library plus a katha binary). You need a Rust toolchain matching rust-toolchain.toml.
bash
cargo test # run the suite
cargo fmt --all # format
cargo clippy --all-targets -- -D warnings # lint (warnings are errors in CI)cargo run -- preview renders a sample email to preview.html without touching a database — handy for eyeballing template changes. See the readme for the other subcommands and the configuration variables.
Pull requests
- Keep changes focused; add tests for new behavior and bug fixes.
- Web pages are written in maud (
src/view.rs), not template files: the markup compiles into Rust, so a malformed page is a build error rather than a startup or request-time one. Values are escaped automatically and maud writes the attribute quotes itself, so there is no quoting rule to remember. The one thing to know:PreEscapedbypasses escaping. It is used twice, on compiled-in constants — never wrap anything that reader input, Kavita, or configuration can influence. Auditing it means looking forPreEscaped, helpers returningMarkup, and hand-writtenRenderimpls — not one grep. - The email (
templates/email.mjml) is still a minijinja template, since MJML is a markup language of its own. It marks its URLs| safe; that is a separate, older decision and is not a licence to add more. - CI must be green:
cargo fmt --all -- --check,clippy -D warnings, andcargo test --lockedall run on every PR. - Commit messages follow Conventional Commits (
feat:,fix:,docs:,refactor:,test:,chore:) — releases and the changelog are generated from them by semantic-release.
Reporting bugs
Open an issue with steps to reproduce. For security issues, see security.md.