diff --git a/README.md b/README.md index ce6ab8ca..9ba88a91 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ fn main() -> std::io::Result<()> { wrap: true, ellipsis: true, fences: true, + footnotes: false, }; let fixed = process_stream_opts(&lines, opts); println!("{}", fixed.join("\n")); @@ -133,7 +134,7 @@ fn main() -> std::io::Result<()> { - `process_stream_opts(lines: &[String], opts: Options) -> Vec` rewrites tables in memory. The options enable paragraph wrapping, ellipsis - substitution and fence normalization. + substitution, fence normalization and footnote conversion. - `rewrite(path: &Path) -> std::io::Result<()>` modifies a Markdown file on disk in-place. diff --git a/src/process.rs b/src/process.rs index 70a4e4bb..bc391858 100644 --- a/src/process.rs +++ b/src/process.rs @@ -10,6 +10,10 @@ use crate::{ }; /// Processing options controlling the behaviour of `process_stream_inner`. +#[expect( + clippy::struct_excessive_bools, + reason = "Options map directly to CLI flags" +)] #[derive(Clone, Copy)] pub struct Options { /// Enable paragraph wrapping @@ -18,6 +22,8 @@ pub struct Options { pub ellipsis: bool, /// Normalise code block fences pub fences: bool, + /// Convert bare numeric references to footnotes + pub footnotes: bool, } #[must_use] @@ -94,7 +100,7 @@ pub fn process_stream_inner(lines: &[String], opts: Options) -> Vec { if opts.ellipsis { out = replace_ellipsis(&out); } - if footnotes { + if opts.footnotes { out = convert_footnotes(&out); } out @@ -108,6 +114,7 @@ pub fn process_stream(lines: &[String]) -> Vec { wrap: true, ellipsis: false, fences: false, + footnotes: false, }, ) } @@ -120,6 +127,7 @@ pub fn process_stream_no_wrap(lines: &[String]) -> Vec { wrap: false, ellipsis: false, fences: false, + footnotes: false, }, ) }