### Install mdterm with cargo install Source: https://github.com/bahdotsh/mdterm/blob/main/README.md Installs the mdterm binary from the current directory. Requires Rust 1.85+ (edition 2024). ```bash cargo install --path . ``` -------------------------------- ### mdterm usage examples Source: https://github.com/bahdotsh/mdterm/blob/main/README.md Shows common mdterm invocations: viewing files, multiple files, JSON, stdin, slide mode, HTML export, light theme, and line numbers. ```bash mdterm README.md # view a file mdterm a.md b.md # multiple files (Tab to switch) mdterm data.json # view a JSON file cat README.md | mdterm # read from stdin mdterm --slides deck.md # slide mode mdterm --export html doc.md > out.html # export to HTML mdterm --theme light README.md # light theme mdterm -l README.md # line numbers in code blocks ``` -------------------------------- ### HashMap usage in Rust Source: https://github.com/bahdotsh/mdterm/blob/main/test.md Example of using a HashMap to store and iterate over key-value pairs. Demonstrates insertion and iterating with a for loop. ```rust use std::collections::HashMap; fn main() { let mut scores: HashMap<&str, i32> = HashMap::new(); scores.insert("Alice", 95); scores.insert("Bob", 87); scores.insert("Charlie", 92); for (name, score) in &scores { println!("{}: {}", name, score); } } ``` -------------------------------- ### Build mdterm with Cargo Source: https://github.com/bahdotsh/mdterm/blob/main/README.md Build mdterm in release mode using Cargo. ```bash cargo build --release ``` -------------------------------- ### mdterm CLI reference Source: https://github.com/bahdotsh/mdterm/blob/main/README.md Command-line usage and options for mdterm. Shows available arguments and flags. ```text mdterm [OPTIONS] [FILES]... Arguments: [FILES]... Markdown file(s) to view Options: -T, --theme Theme: dark or light -w, --width Display width override (0 = auto) -s, --slides Slide mode (--- as slide separators) -l, --line-numbers Show line numbers in code blocks --export Export format (html) --no-color Disable colors -h, --help Print help -V, --version Print version ``` -------------------------------- ### Build and run commands for mdterm Source: https://github.com/bahdotsh/mdterm/blob/main/CLAUDE.md Commands to build, run, check, lint, format, and test the mdterm Rust project. Use these in the project root. ```bash cargo build # debug build cargo build --release # release build cargo run -- # run with a markdown file cargo check # type-check without building cargo clippy # lint cargo fmt # format code cargo test # run tests ``` -------------------------------- ### Rust hello function for link navigation test Source: https://github.com/bahdotsh/mdterm/blob/main/test_linked.md A simple Rust function that prints a message confirming successful navigation via a local link. Use this as a placeholder to verify that relative markdown links work in mdterm. ```rust fn hello() { println!("You successfully followed a local link!"); } ``` -------------------------------- ### mdterm configuration file Source: https://github.com/bahdotsh/mdterm/blob/main/README.md Configuration file for mdterm. Create at ~/.config/mdterm/config.toml. CLI flags override these settings. ```toml theme = "dark" # "dark" or "light" line_numbers = false # show line numbers in code blocks width = 0 # display width (0 = auto) ``` -------------------------------- ### Async data fetching with asyncio Source: https://github.com/bahdotsh/mdterm/blob/main/test.md Asynchronous function to fetch data from multiple URLs using asyncio. Demonstrated with API URLs and simulated network delay. ```python import asyncio async def fetch_data(url: str) -> dict: """Fetch data from a URL asynchronously.""" await asyncio.sleep(1) return {"url": url, "status": 200} async def main(): urls = ["https://api.example.com/a", "https://api.example.com/b"] tasks = [fetch_data(url) for url in urls] results = await asyncio.gather(*tasks) for r in results: print(f"{r['url']} -> {r['status']}") asyncio.run(main()) ``` -------------------------------- ### Fibonacci sequence in Go Source: https://github.com/bahdotsh/mdterm/blob/main/test.md Recursive Fibonacci function that prints the first ten Fibonacci numbers using a loop. ```go package main import "fmt" func fibonacci(n int) int { if n <= 1 { return n } return fibonacci(n-1) + fibonacci(n-2) } func main() { for i := 0; i < 10; i++ { fmt.Printf("fib(%d) = %d\n", i, fibonacci(i)) } } ``` -------------------------------- ### Workflow diagram in Mermaid Source: https://github.com/bahdotsh/mdterm/blob/main/test.md Mermaid diagram showing a simple workflow with a decision point and two possible actions. ```mermaid graph TD A[Start] --> B{Decision} B -->|Yes| C[Action 1] B -->|No| D[Action 2] C --> E[End] D --> E ``` -------------------------------- ### Pipe mdterm output to less Source: https://github.com/bahdotsh/mdterm/blob/main/README.md When piped, mdterm outputs styled text without the interactive viewer, allowing use with pagers like less. ```bash mdterm README.md | less -R ``` -------------------------------- ### Debounce function in JavaScript Source: https://github.com/bahdotsh/mdterm/blob/main/test.md Implements a debounce function that delays invoking a function until after a specified time has elapsed since the last call. ```javascript const debounce = (fn, ms) => { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(() => fn(...args), ms); }; }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.