---
name: "prettybat"
section: "1"
platform: "linux"
package: "bat-extras"
version: "2024.08.24-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/prettybat"
---

# prettybat(1)

Pretty-print source code and highlight it with bat.

## NAME

prettybat - Pretty-print source code and highlight it with *bat*.

## DESCRIPTION

The only thing better than syntax highlighting? Syntax highlighting *and* code formatting. This script combines the best of both worlds by using various formatters to format source files before using *bat* to highlight them.

## USAGE

    prettybat \[OPTIONS\] \[PATH...\]

## OPTIONS

Every option is passed through to *bat*.\
 See *man bat* for more information.

## LANGUAGES

| | |
| --- | --- |
| **Language** | **Formatter** |
|
| JavaScript (JS, JSX) | prettier |
| TypeScript (TS, TSX) | prettier |
| CSS, SCSS, SASS | prettier |
| Markdown | prettier |
| JSON | yq, prettier |
| YAML | yq, prettier |
| HTML | prettier |
| SVG | prettier |
| Rust | rustfmt |
| Bash | shfmt |
| C | ClangFormat |
| C++ | ClangFormat |
| Objective-C | ClangFormat |
| Python | black |
| Elixir | mix format |

## CAVEATS

\- The header displayed by bat will show *STDIN* instead of the filename (*bat 0.13* or older).\
 \- The git changes sidebar will not work with files that have been formatted.
