snippet: Pretty-print regions within source code files
Pretty-print Regions of source-code, i.e. snippets.
This is meant to mimic tooling available in rust and used by tools such as
sarif-fmt.
For example, focusing on a region within our README:
┌─ README.md:32:8
│
32 │ main = do
│ ╭────────^
33 │ │ let
34 │ │ region = Region
35 │ │ { startLine = 32
36 │ │ , endLine = Just 44
37 │ │ , startColumn = Just 8
38 │ │ , endColumn = Nothing
39 │ │ }
40 │ │
41 │ │ -- Returns Nothing if file is missing/empty or region is invalid
42 │ │ mSnippet <- snippetFromFile region "README.md"
43 │ │
44 │ │ traverse_ (putDoc . reAnnotate annToAnsi . prettySnippet) mSnippet
│ ╰────────────────────────────────────────────────────────────────────^
To see the code that produces this, and an image of the output (e.g. with color), view the README on Codeberg.
[Skip to Readme]
Modules
[Index] [Quick Jump]
Downloads
- snippet-0.1.0.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.0.0.0, 0.1.0.0, 0.1.0.1, 0.1.0.2 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | base (>=4.16.4.0 && <5), directory (>=1.3.6.2), prettyprinter (>=1.7.1), prettyprinter-ansi-terminal (>=1.1.3), text (>=1.2.5.0) [details] |
| License | AGPL-3.0-only |
| Author | |
| Maintainer | Patrick Brisbin |
| Uploaded | by PatrickBrisbin at 2026-10-28T18:25:54Z |
| Category | Data |
| Home page | https://codeberg.org/pbrisbin/snippet#readme |
| Bug tracker | https://codeberg.org/pbrisbin/snippet/issues |
| Source repo | head: git clone https://codeberg.org/pbrisbin/snippet |
| Distributions | |
| Downloads | 9 total (9 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Last success reported on 2026-10-28 [all 1 reports] |
