blob: b25b5c63619bd5aa32fb6c21c68a9766ad8f071e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//! Entry point for the `r2md-fence` helper binary.
//!
//! This binary reads stdin, wraps it in a Markdown fenced code block, and writes the result to
//! stdout. It is useful for safely embedding generated Markdown or arbitrary text inside LLM
//! prompts or another Markdown document.
use std::io;
use clap::Parser;
use repo2markdown::fence_wrapper::wrap_in_fence;
/// Wrap stdin in a Markdown fenced code block.
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
struct Cli {
/// Language tag to append to the opening markdown fence.
#[arg(long, short, default_value = "")]
language: String,
}
fn main() -> io::Result<()> {
let cli = Cli::parse();
let stdin = io::stdin();
let stdout = io::stdout();
wrap_in_fence(stdin.lock(), stdout.lock(), &cli.language)
}
|