diff options
Diffstat (limited to 'src/fence_wrapper.rs')
| -rw-r--r-- | src/fence_wrapper.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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<R: Read, W: Write>( mut input: R, mut output: W, |
