rumdl
rumdl is a high-performance Markdown linter and formatter written in Rust. It offers 71 lint rules, automatic formatting, and zero dependencies, providing a fast and consistent way to enforce best practices in Markdown files. The Python package primarily serves as a distribution mechanism for the `rumdl` CLI binary, and the project is actively maintained with frequent releases.
Common errors
-
rumdl executable not found
cause The `rumdl` binary is either not installed, or its installation path is not included in your system's PATH environment variable. This can happen even after `pip install rumdl` if the pip binary directory isn't in PATH.fixEnsure `rumdl` is installed (e.g., `pip install rumdl`). Check your system's PATH variable to ensure the directory containing the `rumdl` executable (often in `~/.local/bin` for user installs or a virtual environment's `bin` folder) is included. On some systems, you might need to manually add it to PATH or use the full path to the executable. -
rumdl check reports X fixable issues, but rumdl fmt or rumdl check --fix makes no changes
cause This was a known bug in earlier versions (e.g., pre-0.1.5) where the fixable issue count in the report was inaccurate or the fixer didn't apply expected changes for certain rules (like MD033).fixEnsure you are using a recent version of `rumdl` (at least 0.1.5 or newer, preferably the latest). If the problem persists, it may be an unfixable violation or a new edge case; report it to the `rumdl` GitHub issues with a reproducible example. -
MD032: List should be followed by blank line reports false positives with indented tables
cause In older versions (e.g., 0.1.51), `rumdl`'s list detection could be broken by indented tables within a list, incorrectly flagging MD032 violations.fixThis specific issue was fixed in a later version of `rumdl`. Update your `rumdl` installation to the latest version to resolve this bug.
Warnings
- gotcha rumdl's configuration is highly flexible, but understanding precedence is crucial. CLI flags take highest priority, overriding discovered `.rumdl.toml`, `rumdl.toml`, `.config/rumdl.toml`, or `pyproject.toml` configurations. Local per-directory configurations also override root configurations.
- gotcha rumdl, while largely compatible with `markdownlint`, has intentional behavioral differences for certain rules (e.g., MD004 for unordered list style, MD005/MD007 for list indentation). These are design decisions for CommonMark compliance or improved logic.
- gotcha Linting very large Markdown files (e.g., >1MB) or enabling an excessive number of rules, especially with complex regex patterns, can lead to slower performance, despite `rumdl`'s Rust-based speed.
Install
-
pip install rumdl
Imports
- rumdl
import subprocess # rumdl is primarily a CLI tool; there is no direct Python API for linting functions. # Interact via subprocess calls.
Quickstart
import subprocess
import os
# Create a dummy markdown file
markdown_content = """
# Hello World
This is a test.
- List item 1
- List item 2
- Nested list item
Some **bold** text.
"""
file_path = "test.md"
with open(file_path, "w") as f:
f.write(markdown_content)
print(f"Linting {file_path}...")
# Run rumdl check
# capture_output=True and text=True are important for programmatic interaction
result = subprocess.run(['rumdl', 'check', file_path], capture_output=True, text=True)
if result.returncode != 0:
print("Linting found issues:")
print(result.stdout)
print(result.stderr)
else:
print("No linting issues found.")
# Optionally, try formatting:
# result_fmt = subprocess.run(['rumdl', 'fmt', file_path], capture_output=True, text=True)
# if result_fmt.returncode != 0:
# print("Formatting failed:")
# print(result_fmt.stdout)
# print(result_fmt.stderr)
# else:
# print("File formatted successfully (or no changes needed).")
# with open(file_path, "r") as f:
# print("Formatted content:")
# print(f.read())
# Clean up the dummy file
os.remove(file_path)