MarkView provides full command-line integration, allowing you to open files and directories directly from your terminal. This is perfect for power users who prefer CLI workflows.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sureshamal/markview/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Once built, MarkView can be invoked from the command line with file or directory paths as arguments. The application will automatically load and display the specified content.The CLI functionality is powered by Rust commands that parse command-line arguments and load files during application startup.
Basic Usage
Single File
Open a single Markdown file:Multiple Files
Load multiple files at once by passing multiple arguments:Directory
Load all Markdown files from a directory:.md and .markdown files in the specified directory.
Current Directory
Load all Markdown files in the current directory:Path Resolution
MarkView intelligently handles both relative and absolute paths.Relative Paths
Relative paths are resolved against the current working directory:Absolute Paths
Absolute paths are used as-is:Path Resolution Implementation
The Rust backend handles path resolution:How Path Resolution Works
How Path Resolution Works
- CLI arguments are collected (skipping the first argument, which is the executable name)
- Each argument is checked to determine if it’s an absolute or relative path
- Absolute paths are passed through unchanged
- Relative paths are joined with the current working directory
- The resolved paths are returned to the frontend
Platform-Specific Examples
- Linux / macOS
- Windows
Backend Implementation
The command-line functionality is implemented through three Rust commands:1. get_cli_args
Retrieves and resolves command-line arguments:Vec<String> - Array of resolved file/directory paths
2. read_markdown_file
Reads a single Markdown file from disk:path: String- Absolute path to the Markdown file
Result<FileData, String>
FileData { name: String, content: String }on success- Error message string on failure
3. read_markdown_dir
Reads all Markdown files from a directory:path: String- Absolute path to the directory
Result<Vec<FileData>, String>
- Array of
FileDataobjects for all Markdown files found - Empty array if directory contains no Markdown files
Frontend Integration
The frontend automatically processes CLI arguments on application startup:Determine Path Type
Each path is checked to determine if it’s a file (
.md or .markdown extension) or a directory.Load Content
- Files are loaded with
read_markdown_file() - Directories are loaded with
read_markdown_dir()
FileData Structure
Both file reading commands return data in this format:The filename (not the full path) extracted using
file_name()The complete file content as a UTF-8 string
Error Handling
The CLI implementation includes graceful error handling:File Reading Errors
Common Error Scenarios
Common Error Scenarios
- File not found: Silently logged to console
- Permission denied: Logged to console, file skipped
- Invalid UTF-8: File is skipped
- Not a Markdown file: Ignored by extension check
- Not running in Tauri: CLI arguments are skipped (for web development)
Building for CLI Usage
To use MarkView from the command line, you need to build the production binary:Advanced Usage
Shell Aliases
Create convenient aliases for common operations:Integration with Other Tools
Combine MarkView with other CLI tools:Scripting
Use MarkView in scripts for documentation viewing:Comparison with GUI Methods
CLI Advantages
- Fast for power users
- Scriptable and automatable
- Integrates with other tools
- Quick access from anywhere
GUI Advantages
- Visual file selection
- Drag and drop support
- Easier for beginners
- No path typing required
Troubleshooting
Command not found
Command not found
Problem: Shell can’t find the
markview command.Solution:- Use the full path:
./markviewor/path/to/markview - Add MarkView to your PATH environment variable
- Check that the binary has execute permissions:
chmod +x markview
Files not loading
Files not loading
Problem: CLI arguments are passed, but files don’t open.Solution:
- Verify file paths are correct and files exist
- Check file extensions are
.mdor.markdown - Ensure you have read permissions for the files
- Check console logs for error messages
Relative paths not working
Relative paths not working
Problem: Relative paths don’t resolve correctly.Solution:
- Use absolute paths instead
- Ensure you’re in the correct directory when using relative paths
- Check that the current working directory is accessible
Directory scan incomplete
Directory scan incomplete
Problem: Not all Markdown files from a directory are loaded.Solution:
- Remember that only the top-level directory is scanned (no recursion)
- Check file extensions are exactly
.mdor.markdown - Verify files are readable and contain valid UTF-8 text
Next Steps
Opening Files
Explore all methods to load files into MarkView
Navigation
Master the UI navigation features