process_file_includes

Function process_file_includes 

Source
pub fn process_file_includes(
    markdown: &str,
    base_dir: &Path,
    depth: usize,
) -> Result<(String, Vec<IncludedFile>), String>
Expand description

Process file includes in Nixpkgs/NixOS documentation.

This function processes file include syntax:

```{=include=}
path/to/file1.md
path/to/file2.md
```

§Arguments

  • markdown - The input markdown text
  • base_dir - The base directory for resolving relative file paths
  • depth - Current recursion depth (use 0 for initial call)

§Returns

Returns Ok((processed_markdown, included_files)) where included_files is a list of all successfully included files.

§Errors

Returns Err(message) if recursion depth exceeds [MAX_INCLUDE_DEPTH], which likely indicates a circular include cycle.

§Safety

Only relative paths without “..” are allowed for security.