fn collect_referenced_files(
md: &str,
md_path: &Path,
input_dir: &Path,
) -> Vec<(PathBuf, PathBuf)>Expand description
Parse md for local link and image targets that are not other Markdown
files, resolve them relative to md_path’s parent directory, and return
those that exist as files within input_dir.
Returns a list of (absolute_source_path, relative_path_from_input_dir)
pairs. The caller uses the relative path to mirror the asset at the same
position inside the output directory, keeping all relative URLs in the
rendered HTML valid.
Skipped silently:
- Remote URLs (
://), data URIs, and fragment-only refs (#…). .mdfiles — those are rendered to.html, not copied.- Refs that do not resolve to an existing file.
- Refs that resolve to a file outside
input_dir(a warning is logged to the caller instead).