diff --git a/AGENTS.md b/AGENTS.md index d1edc3e8..d8a48016 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -157,10 +157,10 @@ project: changes from new major versions. This approach is critical for ensuring build stability and reproducibility. - **Prohibit unstable version specifiers.** The use of wildcard (`*`) or - open-ended inequality (`>=`) version requirements is strictly forbidden, as it - introduces unacceptable risk and unpredictability. Tilde requirements (`~`) - should only be used where a dependency must be locked to patch-level updates - for a specific, documented reason. + open-ended inequality (`>=`) version requirements is strictly forbidden, as + it introduces unacceptable risk and unpredictability. Tilde requirements + (`~`) should only be used where a dependency must be locked to patch-level + updates for a specific, documented reason. ### Error Handling diff --git a/src/html.rs b/src/html.rs index c3372881..b148e314 100644 --- a/src/html.rs +++ b/src/html.rs @@ -84,7 +84,9 @@ fn is_element(handle: &Handle, tag: &str) -> bool { } /// Returns `true` if `handle` represents a `` or `` element. -fn is_table_cell(handle: &Handle) -> bool { is_element(handle, "td") || is_element(handle, "th") } +fn is_table_cell(handle: &Handle) -> bool { + is_element(handle, "td") || is_element(handle, "th") +} /// Walks the DOM tree collecting `` nodes under `handle`. fn collect_tables(handle: &Handle, tables: &mut Vec) { @@ -112,10 +114,10 @@ fn is_bold_tag(tag: &str) -> bool { /// Returns `true` if `handle` contains a `` or `` descendant. fn contains_strong(handle: &Handle) -> bool { - if let NodeData::Element { name, .. } = &handle.data - && is_bold_tag(name.local.as_ref()) - { - return true; + if let NodeData::Element { name, .. } = &handle.data { + if is_bold_tag(name.local.as_ref()) { + return true; + } } let children = handle.children.borrow(); children.iter().any(contains_strong) diff --git a/src/io.rs b/src/io.rs index cb30bea4..e9bd9c17 100644 --- a/src/io.rs +++ b/src/io.rs @@ -30,7 +30,9 @@ where /// /// # Errors /// Returns an error if reading or writing the file fails. -pub fn rewrite(path: &Path) -> std::io::Result<()> { rewrite_with(path, process_stream) } +pub fn rewrite(path: &Path) -> std::io::Result<()> { + rewrite_with(path, process_stream) +} /// Rewrite a file in place without wrapping text. /// diff --git a/src/wrap.rs b/src/wrap.rs index 460c9dbd..3f9e58ef 100644 --- a/src/wrap.rs +++ b/src/wrap.rs @@ -13,7 +13,8 @@ mod tokenize; /// Re-export this so callers of [`crate::textproc`] can implement custom /// transformations without depending on internal modules. pub use tokenize::Token; -/// Tokenize a block of Markdown while preserving fence context. +/// Convenience re-export of [`tokenize::tokenize_markdown`]. +#[doc(inline)] pub use tokenize::tokenize_markdown; static FENCE_RE: std::sync::LazyLock = @@ -52,11 +53,17 @@ struct PrefixHandler { } impl PrefixHandler { - fn build_bullet_prefix(cap: &Captures) -> String { cap[1].to_string() } + fn build_bullet_prefix(cap: &Captures) -> String { + cap[1].to_string() + } - fn build_footnote_prefix(cap: &Captures) -> String { format!("{}{}", &cap[1], &cap[2]) } + fn build_footnote_prefix(cap: &Captures) -> String { + format!("{}{}", &cap[1], &cap[2]) + } - fn build_blockquote_prefix(cap: &Captures) -> String { cap[1].to_string() } + fn build_blockquote_prefix(cap: &Captures) -> String { + cap[1].to_string() + } } static HANDLERS: &[PrefixHandler] = &[ @@ -189,7 +196,9 @@ fn wrap_preserving_code(text: &str, width: usize) -> Vec { } #[doc(hidden)] -pub fn is_fence(line: &str) -> bool { FENCE_RE.is_match(line) } +pub fn is_fence(line: &str) -> bool { + FENCE_RE.is_match(line) +} pub(crate) fn is_markdownlint_directive(line: &str) -> bool { MARKDOWNLINT_DIRECTIVE_RE.is_match(line) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 64b5fc38..ff4729e8 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -19,7 +19,7 @@ macro_rules! lines_vec { /// /// Example: /// ``` -/// let input: Vec = include_lines!("data/bold_header_input.txt"); +/// let input: Vec = include_lines!("data/bold_header_input.txt"); /// ``` #[expect(unused_macros, reason = "macros are optional helpers across modules")] macro_rules! include_lines {