···11+# Contributing
22+33+Thank you for your interest in contributing to `leaf`.
44+55+## Getting Started
66+77+1. Fork the repository.
88+2. Clone your fork:
99+1010+```bash
1111+git clone https://github.com/<your-username>/leaf.git
1212+cd leaf
1313+```
1414+1515+3. Install Rust if needed:
1616+1717+```bash
1818+rustup show
1919+```
2020+2121+4. Build the project:
2222+2323+```bash
2424+cargo build
2525+```
2626+2727+5. Run the application:
2828+2929+```bash
3030+cargo run -- README.md
3131+```
3232+3333+## Development Workflow
3434+3535+Before submitting a PR, run the full validation sequence:
3636+3737+```bash
3838+cargo test
3939+cargo clippy --all-targets --all-features -- -D warnings
4040+cargo build --release
4141+```
4242+4343+## Pull Requests
4444+4545+1. Create a feature branch from `main`.
4646+2. Make focused changes.
4747+3. Keep documentation in sync when behavior changes.
4848+4. Ensure all checks pass.
4949+5. Open a PR with a clear description of:
5050+ - what changed;
5151+ - why it changed;
5252+ - how it was tested.
5353+5454+## Commit Messages
5555+5656+- Use clear, direct messages.
5757+- Keep the first line short.
5858+- Prefer the existing prefixes used in the repository when they fit.
5959+6060+Examples:
6161+6262+- `feat: custom themes`
6363+- `chore: refactor main.rs`
6464+- `fix: file picker alignment`
6565+- `docs: update README.md`
6666+6767+## Code Style
6868+6969+- Follow the existing Rust style in the repository.
7070+- Prefer small, targeted refactors over broad rewrites.
7171+- Preserve the current terminal UX unless the change explicitly improves it.
7272+- Keep ASCII by default unless the file already uses Unicode intentionally.
7373+7474+## Testing Notes
7575+7676+- Add regression tests when fixing rendering or parsing bugs.
7777+- Prefer narrow, behavior-focused tests over snapshot-heavy tests.
7878+- If a change affects terminal layout, verify both tests and manual rendering.
7979+8080+## Architecture
8181+8282+See:
8383+8484+- [ARCHITECTURE.md](./ARCHITECTURE.md)
8585+8686+## Releases
8787+8888+Release automation lives in:
8989+9090+- [.github/workflows/release-cut.yml](./.github/workflows/release-cut.yml)
9191+- [.github/workflows/release-build.yml](./.github/workflows/release-build.yml)
9292+- [scripts/release-cut.sh](./scripts/release-cut.sh)
9393+9494+Installers live in:
9595+9696+- [scripts/install.sh](./scripts/install.sh)
9797+- [scripts/install.ps1](./scripts/install.ps1)
9898+9999+## Questions
100100+101101+Open an issue or discussion in the repository:
102102+103103+- https://github.com/RivoLink/leaf/issues
104104+- https://github.com/RivoLink/leaf/discussions
+38-23
README.md
···66 Terminal Markdown previewer — GUI-like experience.
77</p>
8899-## Install
1010-1111-Install the latest published binary:
99+## Install or update
12101313-```bash
1414-curl -fsSL https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.sh | sh
1515-```
1111+Install or update to the latest published binary.
16121717-Or download then run:
1313+macOS / Linux / Android / Termux:
18141915```bash
2020-curl -fsSL -o install.sh https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.sh
2121-sh install.sh ~/.local/bin
1616+curl -fsSL https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.sh | sh
2217```
23182424-On Windows:
1919+Windows:
25202621```powershell
2722irm https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.ps1 | iex
2823```
29243030-Or download then run:
2525+Verify the installation:
31263232-```powershell
3333-Invoke-WebRequest https://raw.githubusercontent.com/RivoLink/leaf/main/scripts/install.ps1 -OutFile install.ps1
3434-powershell -ExecutionPolicy Bypass -File .\install.ps1 -Destination $env:LOCALAPPDATA\Programs\leaf
2727+```bash
2828+leaf --version
3529```
36303731## Build
3232+3333+Clone the repository:
3434+3535+```bash
3636+git clone https://github.com/RivoLink/leaf.git
3737+cd leaf
3838+```
38393940Build the release binary locally:
4041···5556export PATH="$HOME/.local/bin:$PATH"
5657```
57585858-Check the installed version:
5959-6060-```bash
6161-leaf --version
6262-```
6363-6459## Usage
65606661```bash
···7772# Pipe from stdin
7873claude "explain Rust lifetimes" | leaf
7974cat TESTING.md | leaf
7575+7676+# Open the file picker in the current directory
7777+leaf
8078```
81798280## Keybindings
···10199## Features
102100103101- ✅ **Watch mode** `--watch` / `-w` — reloads every 250ms, with `⟳ reloaded` flash feedback
104104-- ✅ Syntax highlighting (200+ languages, syntect)
102102+- ✅ Syntax highlighting with common language aliases like `py`, `cpp`, `json`, `toml`, `ps1`, and `dockerfile`
105103- ✅ Unicode box-drawing tables with left / center / right alignment
106104- ✅ TOC sidebar with active section tracking and two-level navigation
107107-- ✅ Search with match highlighting and `n` / `N`
105105+- ✅ Search with match highlighting, `/`, `Ctrl+F`, and `n` / `N`
108106- ✅ Code blocks `┌─ lang ───┐`
109107- ✅ Bold, italic, strikethrough, blockquotes, lists, and horizontal rules
110108- ✅ YAML frontmatter is ignored in both preview and TOC
111111-- ✅ Native stdin input
109109+- ✅ Native stdin input with bounded size
110110+- ✅ File picker when launched without a file
111111+- ✅ Theme picker with runtime preview
112112+- ✅ Help modal with in-app shortcuts
112113113114## Typical AI Workflow
114115···126127- [ ] Copy code block `y`
127128- [ ] Code block horizontal scroll
128129- [ ] Improve search performance on large files
130130+131131+## Troubleshooting
132132+133133+### Windows: missing Visual C++ runtime
134134+135135+If `leaf.exe` does not start on Windows and reports a missing MSVC runtime, install the latest supported Microsoft Visual C++ Redistributable from Microsoft Learn:
136136+137137+- https://learn.microsoft.com/fr-fr/cpp/windows/latest-supported-vc-redist?view=msvc-170
138138+139139+Direct download for the latest supported **X64** Microsoft Visual C++ Redistributable:
140140+141141+- https://aka.ms/vc14/vc_redist.x64.exe
142142+143143+For `leaf-windows-x86_64.exe`, the relevant package is the latest supported **X64** Visual C++ v14 Redistributable.
+46
SECURITY.md
···11+# Security Policy
22+33+## Reporting a Vulnerability
44+55+If you discover a security vulnerability in `leaf`, please report it responsibly.
66+77+**Do not open a public issue for security vulnerabilities.**
88+99+Instead, use one of these channels:
1010+1111+- [GitHub private vulnerability reporting](https://github.com/RivoLink/leaf/security/advisories/new)
1212+- Email the maintainer directly at [rivo.link@gmail.com](mailto:rivo.link@gmail.com)
1313+1414+Please include:
1515+1616+- a clear description of the issue;
1717+- steps to reproduce;
1818+- potential impact;
1919+- affected versions or release assets;
2020+- a suggested fix, if you have one.
2121+2222+We will review the report and respond as quickly as possible.
2323+2424+## Scope
2525+2626+This policy covers the `leaf` repository, including:
2727+2828+- the `leaf` CLI/TUI application;
2929+- Markdown parsing and rendering logic;
3030+- release workflows and published binaries;
3131+- install scripts for Unix-like systems and Windows;
3232+- repository documentation when it affects security-sensitive behavior.
3333+3434+## Best Practices for Users
3535+3636+- Install `leaf` from official releases or the documented install scripts.
3737+- Keep `leaf` updated to the latest release.
3838+- Review scripts before piping them into a shell if your environment requires stricter controls.
3939+- On Windows, install the latest supported Microsoft Visual C++ Redistributable from Microsoft if required by the published binary.
4040+- Avoid running untrusted Markdown content with unrealistic expectations of isolation; `leaf` is a local preview tool, not a sandbox.
4141+4242+## Supported Versions
4343+4444+Security fixes are generally applied to the latest released version.
4545+4646+If a vulnerability affects older releases, fixes may be backported at maintainer discretion.