standard_changelog/lib.rs
1//! Changelog generation from conventional commits.
2//!
3//! Groups parsed commits by type, renders markdown sections, and manages
4//! `CHANGELOG.md` files. Pure library — no I/O, no git operations, no
5//! terminal output.
6//!
7//! # Main entry points
8//!
9//! - [`build_release`] — parse raw commits into a [`VersionRelease`]
10//! - [`render`] — render multiple releases into a full `CHANGELOG.md`
11//! - [`render_version`] — render a single version section
12//! - [`prepend_release`] — splice a new release into an existing changelog
13//!
14//! # Example
15//!
16//! ```
17//! use standard_changelog::{build_release, render, ChangelogConfig, RepoHost};
18//!
19//! let commits = vec![
20//! ("abc1234", "feat(auth): add OAuth2 PKCE flow"),
21//! ("def5678", "fix: handle expired tokens"),
22//! ];
23//!
24//! let config = ChangelogConfig::default();
25//! let mut release = build_release(&commits, "1.0.0", None, &config).unwrap();
26//! release.date = "2026-03-14".to_string();
27//!
28//! let host = RepoHost::Unknown;
29//! let changelog = render(&[release], &config, &host);
30//! assert!(changelog.contains("## 1.0.0 (2026-03-14)"));
31//! assert!(changelog.contains("### Features"));
32//! assert!(changelog.contains("### Bug Fixes"));
33//! ```
34
35mod build;
36mod date;
37mod host;
38mod link;
39mod model;
40mod render;
41pub use build::build_release;
42pub use date::{days_to_date, format_date};
43pub use host::detect_host;
44pub use model::*;
45pub use render::{prepend_release, render, render_version};