is_markdown_file

Function is_markdown_file 

Source
pub fn is_markdown_file(path: &Path) -> bool
Expand description

Check if a path represents a Markdown file based on its extension.

This function validates file paths to determine if they should be treated as Markdown files. It performs case-insensitive extension checking to support different naming conventions across platforms.

§Supported Extensions

  • .md (most common)
  • .markdown (verbose form)
  • Case variations: .MD, .Markdown, etc.

§Arguments

  • path - The file path to check

§Returns

  • true if the file has a recognized Markdown extension
  • false otherwise (including files with no extension)

§Examples

assert!(is_markdown_file(Path::new("agent.md")));
assert!(is_markdown_file(Path::new("README.MD")));
assert!(is_markdown_file(Path::new("guide.markdown")));
assert!(!is_markdown_file(Path::new("config.toml")));
assert!(!is_markdown_file(Path::new("script.sh")));
assert!(!is_markdown_file(Path::new("no-extension")));