mat-cli 0.1.1

Beautiful markdown rendering for the terminal
<p align="center">
  <img src="logo.png" alt="mat logo" width="200">
</p>

<h1 align="center">mat</h1>

<p align="center">
  <a href="https://crates.io/crates/mat-cli"><img src="https://img.shields.io/crates/v/mat-cli.svg" alt="crates.io"></a>
  <a href="https://github.com/meekgeek/mat/blob/main/LICENSE"><img src="https://img.shields.io/crates/l/mat-cli.svg" alt="license"></a>
  <a href="https://crates.io/crates/mat-cli"><img src="https://img.shields.io/crates/d/mat-cli.svg" alt="downloads"></a>
</p>

<p align="center">A beautiful markdown renderer for the terminal, written in Rust.</p>

Like [`bat`](https://github.com/sharkdp/bat) is to `cat`, `mat` is to your markdown files — rendering them with syntax highlighting, colors, and Unicode decorations right in your terminal.

Inspired by [render-markdown.nvim](https://github.com/MeanderingProgrammer/render-markdown.nvim), but for the CLI.

## Features

- **Headings** with colored prefixes and level indicators
- **Code blocks** with syntax highlighting (via [syntect]https://github.com/trishume/syntect), language labels, and box-drawing borders
- **Inline code** with distinct background styling
- **Tables** with Unicode box-drawing characters (`┌─┬─┐`) and column alignment
- **Lists** with cycling bullet symbols (``, ``, ``, ``) and ordered numbering
- **Task lists** with `` / `` checkboxes
- **Blockquotes** with colored `` bars and nesting support
- **GitHub alerts** (`NOTE`, `TIP`, `WARNING`, `IMPORTANT`, `CAUTION`) with icons
- **Links** with underlined text and dimmed URLs
- **Images** with alt text and `🖼` icon
- **Bold**, *italic*, ~~strikethrough~~, and underline via ANSI
- **Horizontal rules** as full-width lines
- **Auto-paging** through `less` when output exceeds terminal height
- **Dark and light themes**
- **Stdin support** — pipe markdown from other commands

## Installation

### From source

```bash
git clone https://github.com/meekgeek/mat.git
cd mat
cargo install --path .
```

### With cargo

```bash
cargo install mat-cli
```

## Usage

```bash
# Render a markdown file
mat README.md

# Render multiple files
mat file1.md file2.md

# Pipe from stdin
echo '# Hello' | mat
cat notes.md | mat

# Use light theme
mat -t light README.md

# Disable paging
mat --paging never README.md

# Plain output (no colors/decorations)
mat --plain README.md

# Set custom width
mat -w 100 README.md
```

## Options

```
mat [OPTIONS] [FILE]...

Arguments:
  [FILE]...  Files to display. Use "-" for stdin.

Options:
  -t, --theme <THEME>    Color theme [default: dark] [possible: dark, light]
  -p, --plain            Plain output with no colors or decorations
      --paging <MODE>    When to use the pager [default: auto] [possible: auto, always, never]
      --pager <CMD>      Pager command [env: MAT_PAGER]
  -w, --width <COLS>     Wrap width in columns, 0 = terminal width [default: 0]
      --no-highlight     Disable syntax highlighting in code blocks
  -h, --help             Print help
  -V, --version          Print version
```

## Paging

By default, `mat` pipes output through `less -RFX` when it exceeds your terminal height (same behavior as `bat` and `git`). Control this with:

- `--paging auto` — page only when needed (default)
- `--paging always` — always use the pager
- `--paging never` — write directly to stdout

Override the pager command with `--pager`, the `MAT_PAGER` environment variable, or the standard `PAGER` variable.

## Themes

`mat` ships with two built-in themes:

- **dark** (default) — optimized for dark terminal backgrounds
- **light** — optimized for light terminal backgrounds

## License

MIT