summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fenced_md_generator.rs12
-rw-r--r--src/md_generator.rs17
2 files changed, 29 insertions, 0 deletions
diff --git a/src/fenced_md_generator.rs b/src/fenced_md_generator.rs
index 41ca8cc..7cc5e37 100644
--- a/src/fenced_md_generator.rs
+++ b/src/fenced_md_generator.rs
@@ -1,3 +1,8 @@
+//! Generate Markdown and wrap the entire result in an outer Markdown fence.
+//!
+//! This module is useful when the generated project Markdown needs to be embedded inside another
+//! document or a prompt.
+
use std::{
io::{Read, Write},
path::Path,
@@ -8,6 +13,13 @@ use crate::{
util::fence::generate_outer_backticks,
};
+/// Generates Markdown from a null-separated path list and wraps the full output in a fence.
+///
+/// The inner Markdown is produced by [`generate_markdown_from_paths`]. The outer fence length is
+/// chosen so that any backtick runs inside the generated Markdown cannot close the outer fence.
+///
+/// `render_options` controls file-size limits and placeholder behavior. `root` controls displayed
+/// relative paths, while `origin_base` controls how relative input paths are resolved.
pub fn generate_fenced_markdown<R: Read, W: Write>(
input: R,
mut output: W,
diff --git a/src/md_generator.rs b/src/md_generator.rs
index 54b7cbb..48f066c 100644
--- a/src/md_generator.rs
+++ b/src/md_generator.rs
@@ -1,3 +1,8 @@
+//! Generate Markdown from null-separated path lists.
+//!
+//! This module reads a stream of NUL-separated file paths, normalizes each path, skips duplicates,
+//! and renders selected files into Markdown.
+
use std::{
collections::HashSet,
ffi::OsStr,
@@ -15,6 +20,18 @@ use crate::{
const DEFAULT_PROJECT_NAME: &str = "Project Outline";
+/// Generates Markdown for the files listed in `input`.
+///
+/// `input` is expected to contain a NUL-separated sequence of paths, such as output from
+/// `find -print0` or `git ls-files -z`.
+///
+/// Relative input paths are resolved against `origin_base`. File headings use paths made relative
+/// to `root`.
+///
+/// Duplicate files are skipped after normalization, while preserving the first occurrence order.
+///
+/// Rendering behavior such as file-size limits and placeholder output is controlled by
+/// `render_options`.
pub fn generate_markdown_from_paths<R: Read, W: Write>(
mut input: R,
output: W,