Markdown formatter with configurable line length.
uv add formdt# Print formatted output to stdout
formdt README.md
# Write changes back to file
formdt README.md --write
# Override line length
formdt README.md --line-length 120Note
You must specify either -m (all markdown cells) or -c (specific cells) when
formatting notebooks.
# Format all markdown cells
formdt notebook.ipynb -m -w
# Format specific cells (0-indexed)
formdt notebook.ipynb -c "0,2,5" -w
# Format a range of cells
formdt notebook.ipynb -c "1-3,7" -w
# Preview without writing
formdt notebook.ipynb -m -l 65from formdt import format_markdown, Config
text = "This is a very long line that needs to be wrapped."
config = Config(line_length=40)
formatted = format_markdown(text, config)Create a .formdt file in your project root:
{
"line_length": 80
}- Line wrapping: Lines are wrapped at the configured length
- Single line breaks: Joined within paragraphs
- Double line breaks: Preserved as paragraph separators
- Links:
[text](url)patterns are kept intact and never broken across lines- Previews: Previews are also kept intact and never broken across lines
- Preserved blocks: Headings, lists, code fences, and math blocks (
$$) are not modified
# Install dependencies
uv sync
# Run tests
uv run pytestpytestuv sync --all-extras
uv pip install -e .uv run coveralls