markupwright 0.1.3

Template-driven workspace documentation generator
Documentation
use std::path::Path;

pub(super) fn extract(path: &Path, source: &str) -> Option<String> {
    (path.extension()?.to_str()? == "rs").then_some(())?;

    for line in source.lines().take(10) {
        let line = line.trim();

        if line.is_empty() {
            continue;
        }

        return line
            .strip_prefix("//!")
            .map(str::trim)
            .filter(|description| !description.is_empty())
            .map(str::to_string);
    }

    None
}