pub struct DocumentRun<'a> { /* private fields */ }Expand description
A document run with path roles made explicit.
config_path is a logical identity used by per-file configuration. A
separate source_file is exposed to rules that may access the filesystem.
Native adapters usually set both; browser and other virtual adapters set only
config_path.
Implementations§
Source§impl<'a> DocumentRun<'a>
impl<'a> DocumentRun<'a>
pub fn new( content: &'a str, rules: &'a [Box<dyn Rule>], config: &'a Config, ) -> Self
Sourcepub fn file_path(self, path: &'a Path) -> Self
pub fn file_path(self, path: &'a Path) -> Self
Set a real file path for both per-file configuration and rule filesystem access.
Sourcepub fn config_path(self, path: Option<&'a Path>) -> Self
pub fn config_path(self, path: Option<&'a Path>) -> Self
Set a logical path used only for per-file configuration matching.
Sourcepub fn source_file(self, path: Option<&'a Path>) -> Self
pub fn source_file(self, path: Option<&'a Path>) -> Self
Set the filesystem path visible to rules independently of configuration matching.
pub fn verbose(self, verbose: bool) -> Self
pub fn flavor(&self) -> MarkdownFlavor
pub fn analyze(&self) -> Result<DocumentAnalysis, LintError>
pub fn analyze_raw(&self) -> (Result<Vec<LintWarning>, LintError>, FileIndex)
Sourcepub fn fix(&self, max_iterations: usize) -> Result<(String, FixResult), String>
pub fn fix(&self, max_iterations: usize) -> Result<(String, FixResult), String>
Apply every fix and return the document in its own line-ending convention.
Rules fix LF text: a fix() that rebuilds the document joins its lines
with \n, and an inserted line ending is \n. The CLI normalises a file
to LF before it gets here and restores the ending on write; the same
happens here for every caller (LSP, wasm), so a CRLF document comes back
CRLF, and one with mixed endings comes back LF exactly as rumdl fmt
writes it. A document nothing changed comes back byte-identical.