Skip to main content

Module discovery

Module discovery 

Source
Expand description

Shared markdown file discovery semantics.

The CLI walker (file_processor::discovery in the binary crate) and the LSP workspace index scanner answer the same question: which files does rumdl process here? The pieces of that answer that must never diverge live in this module:

  • the markdown extension set and how it is matched,
  • how ignore-file handling (.gitignore, .markdownlintignore, hidden entries) is configured on a walker,
  • how exclude patterns from config are expanded and matched.

Callers still differ deliberately: the LSP skips .git/node_modules/ target outright as an editor-performance safety net, while the CLI walks whatever gitignore semantics allow.

Structs§

ExcludeMatchers
Compiled exclude patterns with directory-pattern expansion applied.
ExplicitIncludeMatchers
Compiled matchers for the explicitly-named files in a set of config include patterns (see explicit_file_name_glob).
MarkdownWalkOptions
Ignore-handling options applied to a markdown discovery walk.

Constants§

MARKDOWN_EXTENSIONS
File extensions rumdl treats as markdown, lowercase.

Functions§

apply_markdown_walk_options
Apply the shared ignore-handling configuration to a walker.
canonicalize_for_matching
Canonicalize path for pattern matching, or None when it cannot be resolved (a missing or unreadable file).
expand_directory_pattern
Expands directory-style patterns to also match files within them. Pattern “dir/path” becomes [“dir/path”, “dir/path/**”] to match both the directory itself and all contents recursively. A leading ~ is expanded first (see expand_home_prefix).
expand_home_prefix
Expand a leading ~ in a path pattern to the user’s home directory, so a user-level config (~/.config/rumdl/rumdl.toml) can name a home path without hardcoding a username.
explicit_file_name_glob
The file-name glob of an include pattern that explicitly names files, if it does.
has_markdown_extension
Whether path has a markdown extension.
is_absolute_pattern
Whether pattern names an absolute location. A leading / counts on every platform: patterns use / separators, so a Unix-style path stays absolute when the same config is read on Windows.
is_markdown_extension
Whether ext is a markdown extension. Matches case-insensitively so conventional variants like Rmd (and shouting-case MD) qualify.
markdown_walk_builder
Build a walker over root configured with the shared options.
normalize_pattern_for_base
Normalize a config path pattern for matching against paths discovered under base: expand a leading ~, then rewrite an absolute pattern as one relative to base when base contains it.
path_relative_to
Relativize path against base for exclude-pattern matching, canonicalizing both sides so symlinks (e.g. macOS /tmp) and Windows path-representation differences don’t defeat the prefix strip. Returns None when path is not under base.