Extra File Types
leaf can open any file, not just Markdown. Code files get syntax highlighting, and text files are rendered as plain Markdown.
Configuration
Add file extensions to the extras array in your config.toml:
extras = ["txt", "csv", "rs", "java", "json", "yaml"]
Files with these extensions will appear in the file picker alongside Markdown files.
Direct Opening
Any file can be opened directly from the command line, regardless of the extras setting:
leaf main.rs
leaf package.json
leaf notes.txt
Supported Formats
- Code files (
.rs,.py,.js,.go,.java,.cpp, etc.) — rendered with syntax highlighting. - Text files (
.txt,.csv,.log, etc.) — rendered as plain Markdown. - Markdown files (
.md,.mdx) — always shown, no configuration needed.
Integration with fzf
Browse and preview code files with fzf:
find . -name '*.rs' | fzf --preview 'leaf --inline ansi {}'