From 82b2555d858cc94c4c9b5655ee820d80540ea509 Mon Sep 17 00:00:00 2001 From: A Farzat Date: Fri, 19 Jun 2026 08:19:24 +0300 Subject: Add some docs to r2md-fence and fence_wrapper --- src/bin/r2md-fence.rs | 1 + src/fence_wrapper.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/bin/r2md-fence.rs b/src/bin/r2md-fence.rs index bfaf8d5..cced391 100644 --- a/src/bin/r2md-fence.rs +++ b/src/bin/r2md-fence.rs @@ -3,6 +3,7 @@ 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 { diff --git a/src/fence_wrapper.rs b/src/fence_wrapper.rs index fc8f1c2..565f848 100644 --- a/src/fence_wrapper.rs +++ b/src/fence_wrapper.rs @@ -1,7 +1,18 @@ +//! Utilities for wrapping arbitrary input in a Markdown fenced code block. + use std::io::{Read, Write}; use crate::util::fence::generate_outer_backticks; +/// Reads all input, wraps it in a Markdown fenced code block, and writes it to output. +/// +/// The opening fence includes the supplied language tag. If `lang` is empty, the fence is emitted +/// without a language identifier. +/// +/// The fence length is chosen so that any backtick runs inside the input do not accidentally close +/// the outer fence. +/// +/// This function intentionally writes a blank line before the closing fence. pub fn wrap_in_fence( mut input: R, mut output: W, -- cgit v1.3.1