rumdl

0.1.72 · active · verified Thu Apr 16

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

Warnings

Install

Imports

Quickstart

Demonstrates how to invoke the `rumdl` CLI tool from Python using the `subprocess` module to lint a Markdown file. The primary interaction with `rumdl` is through its command-line interface, which the `pip` package installs.

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)

view raw JSON →