4 releases (2 breaking)

0.3.0 Jan 9, 2026
0.2.1 Jan 10, 2025
0.1.1 Apr 7, 2024
0.1.0 Feb 20, 2024

#67 in Visualization

Download history 255/week @ 2025-10-18 139/week @ 2025-10-25 2230/week @ 2025-11-01 2289/week @ 2025-11-08 4398/week @ 2025-11-15 2746/week @ 2025-11-22 6585/week @ 2025-11-29 7674/week @ 2025-12-06 6715/week @ 2025-12-13 2711/week @ 2025-12-20 1760/week @ 2025-12-27 3611/week @ 2026-01-03 3390/week @ 2026-01-10 3439/week @ 2026-01-17 3684/week @ 2026-01-24 3427/week @ 2026-01-31

14,586 downloads per month
Used in 7 crates (4 directly)

MIT license

89KB
3K SLoC

hi-doc

annotated code example

Diagnostic formatting library.

Motivation

Most diagnostic formatting libraries implement both formatting and span/source management simultaneously. This can be beneficial for consistency, but it requires tying the code of your library to a third-party annotation library, which can be inconvenient, especially when your library already has its own logic for diagnostics.

hi-doc solely implements diagnostic formatting, allowing for seamless integration with existing diagnostic logic within a library.

Finished features

  • Multiple ranges per annotation

  • Multi-line annotations

  • Multi-line annotation text

  • Support for unicode fullwidth characters

    code with fullwidth characters

  • Correct handling of non-printable control characters, and configurable tab width

    tab alignment

  • Formatting of the annotation text itself

  • Syntax highlightning in annotated text

    syntax highlightning

  • Support for non-colored terminals

  • Place annotations on top of the line

Dependencies

~1.2–2.4MB
~47K SLoC