A pre-commit hook for flowmark, a Markdown auto-formatter.
Add to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/patricklittle/flowmark-pre-commit
rev: v0.1.0
hooks:
- id: flowmarkBy default, the hook runs flowmark -i --auto, which enables semantic line breaks, safe cleanups, and in-place formatting.
The -i (inplace) flag is always applied via the hook entry and cannot be overridden.
Override the default --auto by passing args in your hook config. When args is specified, it replaces the default --auto flag entirely — the -i flag remains since it's part of the hook entry.
For example, to match a Makefile target like flowmark -w 100 -i:
hooks:
- id: flowmark
args: ['-w', '100']To restrict which files are formatted:
hooks:
- id: flowmark
args: ['-w', '100']
files: ^(README\.md|docs/.*\.md)$hooks:
- id: flowmark
args: ['--width', '100', '--semantic', '--cleanups', '--nobackup']| Flag | Description |
|---|---|
--auto |
Convenience flag: enables --semantic --cleanups --inplace --nobackup |
-w, --width WIDTH |
Line width in columns (default: 88, 0 = no wrapping) |
-s, --semantic |
Sentence-based line breaks |
-c, --cleanups |
Safe Markdown normalizations |
-i, --inplace |
Edit files in place (always passed as noted above) |
--nobackup |
Skip .orig backup files with --inplace |
--smartquotes |
Convert straight quotes to typographic quotes |
--ellipses |
Convert ... to … |
-p, --plaintext |
Process as plain text, not Markdown |
See flowmark --help for the full list of options.