annotate-snippets
Format diagnostic reports, including highlighting snippets of text
0.12.16
43M downloads/mo
#1353 most downloaded on crates.io
rust-lang/annotate-snippets-rs
What this package is like to depend on
Last release 3 months ago
06 May 2026
Ships unpredictably
gaps range from 8 days to 9 months
Most releases are documented
notes for 33 of 42 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
42 releases · first in 2018
16 releases in the last 12 months
see the full history below
Release timeline
42 releases · Apr 2018 to May 2026Releases
latest 42-
0.12.1606 May 2026 -
0.12.1506 Apr 2026Release notes
Open source →Fixed
- Source highlighting no longer misaligns when source contains zero-width or multi-width characters #400
-
0.12.1404 Apr 2026Release notes
Open source →Fixed
- Don't trim middle of spans smaller than padding + margin
- Properly handle replacement length mismatches
- Account for "gutter" width when trimming middle of long spans
- Account for left trim when trimming middle of long spans
-
0.12.1304 Mar 2026Release notes
Open source → -
0.12.1218 Feb 2026Release notes
Open source →Added
- Add
no_stdsupport #365
[0.12.11] - 2026-01-29
Fixed
- Fix Unicode highlight alignment in patches #357
- Add
-
0.12.1129 Jan 2026 -
0.12.1001 Dec 2025 -
0.12.915 Nov 2025Release notes
Open source →Fixes
- Prefer exact prefix/suffix matches when trimming replacements #345
-
0.12.828 Oct 2025 -
0.12.724 Oct 2025Release notes
Open source →Fixes
- Correctly calculate annotation offsets when trimming unicode characters #331
-
0.12.622 Oct 2025Release notes
Open source →Changed
- Upgraded
unicode-widthto0.2.2#326- This update adds support for Unicode 16 and 17, and can affect character width calculations
- Use straight arrows for standalone
Origin#327
Fixes
- Upgraded
-
0.12.514 Oct 2025 -
0.12.411 Sep 2025Release notes
Open source →Fixes
- Removed implicit padding with report starting with secondary title #310
-
0.12.304 Sep 2025Release notes
Open source →Features
- Add
Title::elementfor less boilerplate - Add
renderer::DEFAULT_*_STYLEto expose default styles
Documentation
- Clarify role of
Renderer::<style>methods
- Add
-
0.12.203 Sep 2025Release notes
Open source →Fixes
- Duplicate multi-line annotations get treated like the are distinct #293
- Allow passing
0toSnippet::line_start#294
-
0.12.102 Sep 2025Release notes
Open source →Fixes
- Correctly calculate line number width when feature
simdis enabled #286 - Close the "code window" when the last line of a
Snippethas no annotations and nothing comes after it #288
- Correctly calculate line number width when feature
-
0.12.028 Aug 2025Release notes
Open source →Migration
Note that the top-level type changed from
MessagetoReport.Messageis now a single block of text within aReport.- Replace
Message::footerwith either- adding a
Messageto aGroup - starting a new
Group
- adding a
- Replace
Level::<Variant>withLevel::<VARIANT>, e.g.Level::Error->Level::ERROR - Instead of creating
Snippets on aMessage(the type returned byLevel::title), add them to theGroupthat is created with theTitle Snippet::originhas been renamed toSnippet::path- Instead of creating an
Annotationfrom aLevel, create them from anAnnotationKindAnnotationKind::Primarywill automatically match theLevelof theGroup- All others existing annotations should likely be
AnnotationKind::Context
Level::titlehas been replaced withLevel::primary_level(for firstGroup) andLevel::secondary_level(subsequentGroups)Message::idhas moved toTitle::id- Renamed
Renderer::line_notoRenderer::line_num - Add
snippet.fold(false)if unspecified, removingsnippet.fold(true)if specified
Features
- Added unicode decor support, see
renderer::DecorStyle - Created [
Group] to indicate what all is included between the unicode begin and end decor - Added
Level::secondary_titleto allow for custom ANSI escape code styling to be applied to thoseTitles - Added
AnnotationKind::Visibleto force spans to be visible within a Snippet, despite code folding, without any visible marker - Added
Originfor referencing code without the source - Added
Group::with_levelto allowSnippets without aTitle - Added
Level::no_nameto hide the level name - Added
Level::with_nameto override what is rendered for that level - Added
Title::id_urlto turnTitle::idinto a link - Added
Patchfor displaying changes to code
Fixes
- Switched strings to
Cow<str>to allow for easier management of owned data Snippet::pathnow acceptsNoneAnnotation::labelnow acceptsNone- Various rendering fixes
- Replace
-
0.11.509 Dec 2024Release notes
Open source →Added
rustc's multiline annotation special case #133- This special case happens when:
- The start of a multiline annotation is at the start of the line disregarding any leading whitespace
- No other multiline annotations overlap it
- This special case happens when:
simdfeature for faster folding #146
Changed
- Multiline annotations with matching spans get merged #133
- Multiple annotations on one line are no longer rendered on separate lines #133
Fixed
-
0.11.415 Jun 2024 -
0.11.306 Jun 2024 -
0.11.227 Apr 2024 -
0.11.121 Mar 2024Release notes
Open source →Fixes
- Switch
foldto use rustc's logic: always show first and last line of folded section and detect if its worth folding - When
folding the start of asource, don't show anything, like we do for the end of thesource - Render an underline for an empty span on
Annotations
- Switch
-
0.11.015 Mar 2024Release notes
Open source →Breaking Changes
- Switched from char spans to byte spans #90
- Renamed
AnnotationTypetoLevel#94 - Renamed
SourceAnnotationtoAnnotation#94 - Renamed
SnippettoMessage#94 - Renamed
SlicetoSnippet#94 Message,Snippet,AnnotationandLevelcan only be built with a builder pattern #91 and #94Annotationlabels are now optional #94Annotationnow takes inRange<usize>instead of(usize, usize)#90Marginis now an internal detail, onlyterm_widthis exposed #105footerwas generalized to be aMessage#98
Added
term_widthwas added toRendererto control the rendering width #105- defaults to 140 when not set
Fixed
Margins are now calculated perSnippet, rather than for the entireMessage#105Annotations can be created without labels
Features
footerwas expanded to allow annotating sources by acceptingMessage#98
-
0.10.229 Feb 2024Release notes
Open source →Added
- Added
testing-colorsfeature to remove platform-specific colors when testing #82
- Added
-
0.10.104 Jan 2024Release notes
Open source → -
0.10.013 Dec 2023Release notes
Open source →Added
Rendereris now used for displaying aSnippet#67Rendereralso controls the color scheme and formatting of the snippet
Changed
- Moved everything in the
snippetto be in the crate root #67
Breaking Changes
Renderernow controls the color scheme and formatting ofSnippets #67- Removed the
StyleandStylesheettraits, as color is controlled byRenderer#67 - Replaced
yansi-termwithanstyle#67anstyleis designed primarily to exist in public APIs for interoperabilityanstyleis re-exported underannotate_snippets::renderer
- Removed the
colorfeature in favor ofRenderer::plain()#67 - Moved
Margintorenderermodule #67 - Made the
display_listmodule private #67
Compatibility
-
0.9.230 Oct 2023Release notes
Open source →- Remove parsing of __ in title strings, fixes (#53)
- Origin line number is not correct when using a slice with fold: true (#52)
-
0.9.104 Sep 2021Release notes
Open source →- Fix character split when strip code. (#37)
- Fix off by one error in multiline highlighting. (#42)
- Fix display of annotation for double width characters. (#46)
-
0.9.028 Jun 2020 -
0.8.014 Apr 2020Release notes
Open source →- Replace
ansi_termwithyansi-termfor improved performance. (#30) - Turn
SnippetandSliceto work on borrowed slices, rather than Strings. (#32) - Fix
\r\nend of lines. (#29)
- Replace
-
0.7.030 Mar 2020Release notes
Open source →- Refactor API to use
fmt::Display(#27) - Fix SourceAnnotation range (#27)
- Fix column numbers (#22)
- Derive
PartialEqforAnnotationType(#19) - Update
ansi_termto 0.12.
- Refactor API to use
-
0.6.123 Jul 2019 -
0.6.026 Jun 2019Release notes
Open source →- Add an option to anonymize line numbers (#3)
- Transition the crate to rust-lang org.
- Update the syntax to Rust 2018 idioms. (#4)
<!-- next-url --> [Unreleased]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.16...HEAD [0.12.16]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.15...0.12.16 [0.12.15]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.14...0.12.15 [0.12.14]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.13...0.12.14 [0.12.13]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.12...0.12.13 [0.12.12]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.11...0.12.12 [0.12.11]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.10..0.12.11 [0.12.10]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.9...0.12.10 [0.12.9]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.8...0.12.9 [0.12.8]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.7...0.12.8 [0.12.7]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.6...0.12.7 [0.12.6]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.5...0.12.6 [0.12.5]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.4...0.12.5 [0.12.4]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.3...0.12.4 [0.12.3]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.2...0.12.3 [0.12.2]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.1...0.12.2 [0.12.1]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.12.0...0.12.1 [0.12.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.5...0.12.0 [0.11.5]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.4...0.11.5 [0.11.4]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.3...0.11.4 [0.11.3]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.2...0.11.3 [0.11.2]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.1...0.11.2 [0.11.1]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.11.0...0.11.1 [0.11.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.10.2...0.11.0 [0.10.2]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.10.1...0.10.2 [0.10.1]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.10.0...0.10.1 [0.10.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.9.2...0.10.0 [0.9.2]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.9.1...0.9.2 [0.9.1]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.9.0...0.9.1 [0.9.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.8.0...0.9.0 [0.8.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.7.0...0.8.0 [0.7.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.6.1...0.7.0 [0.6.1]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.6.0...0.6.1 [0.6.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.5.0...0.6.0 [0.5.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/0.1.0...0.5.0 [0.1.0]: https://github.com/rust-lang/annotate-snippets-rs/compare/6015d08d7d10151c126c6a70c14f234c0c01b50e...0.1.0
-
0.5.005 Jan 2019Nothing published for this version
-
0.1.022 May 2018Nothing published for this version
-
0.0.721 May 2018Nothing published for this version
-
0.0.621 May 2018Nothing published for this version
-
0.0.521 May 2018Nothing published for this version
-
0.0.413 May 2018Nothing published for this version
-
0.0.309 May 2018Nothing published for this version
-
0.0.203 May 2018Nothing published for this version
-
0.0.125 Apr 2018Nothing published for this version