# Contributing
Thanks for your interest in contributing to `smart-format`!
## Development workflow
```bash
git config core.hooksPath .githooks
cargo test --all-features
```
## Quality gates
This repository uses a `rustfmt.toml` that enables unstable options, so formatting checks should use nightly:
```bash
cargo +nightly fmt --all -- --check
cargo check --all-targets
cargo test --all-features
cargo clippy --all-targets -- -D warnings
```
## MSRV
This crate declares MSRV in `Cargo.toml` (`rust-version = "1.85"`). To verify locally:
```bash
rustup toolchain install 1.85.0 --profile minimal
cargo +1.85.0 check --lib
```
## What to test
When adding or modifying combinators, formatters, or escape routines, please include tests for:
- empty inputs
- single-character inputs
- multi-byte Unicode (Cyrillic, CJK, emoji)
- boundary conditions (at the limit, one over, one under)
- chaining with other combinators (at least a 2-step chain)
For feature-gated modules (html, url, xml), run tests with `--all-features`.
## Decision notes
When you add or modify code that involves any of the following:
- an architectural decision (why this approach, not that one)
- a performance trade-off (e.g., two-pass formatting for padding)
- a deliberate limitation (e.g., char-count width, not grapheme-count)
- a security consideration (e.g., escaping attribute names)
you must add an explicit note in the code near the decision point (doc comment or `// NOTE:`)
that explains:
- **Why** this approach was chosen
- **What alternatives** were considered
- **When to revisit** (if applicable)
This is important because smart-format is a public library — contributors and users need to
understand the reasoning behind non-obvious decisions without access to internal planning docs.