From 7ae5e1146684e6daeaf6522cb83a47bbcfefe87e Mon Sep 17 00:00:00 2001 From: A Farzat Date: Sat, 20 Jun 2026 13:11:29 +0300 Subject: Add module/function docs to fence utils --- src/util/fence.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/fence.rs b/src/util/fence.rs index 16f398a..8856336 100644 --- a/src/util/fence.rs +++ b/src/util/fence.rs @@ -1,8 +1,13 @@ +//! Markdown fence helpers. + +/// Returns a backtick fence long enough to wrap `contents` safely. +/// +/// The returned fence is at least three backticks long. If `contents` contains a run of `n` +/// consecutive backticks where `n >= 3`, the returned fence has length `n + 1`. pub fn generate_outer_backticks(contents: impl AsRef<[u8]>) -> String { - let bytes = contents.as_ref(); let mut max_ticks = 0; let mut current_count = 0; - for &byte in bytes { + for &byte in contents.as_ref() { if byte == b'`' { current_count += 1; if current_count > max_ticks { -- cgit v1.3.1