flowmark 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flowmark-0.3.2/.copier-answers.yml +9 -0
- flowmark-0.3.2/.github/workflows/ci.yml +63 -0
- flowmark-0.3.2/.github/workflows/publish.yml +41 -0
- flowmark-0.3.2/.gitignore +179 -0
- flowmark-0.3.2/Makefile +35 -0
- flowmark-0.3.0/README.md → flowmark-0.3.2/PKG-INFO +84 -45
- flowmark-0.3.0/PKG-INFO → flowmark-0.3.2/README.md +69 -65
- flowmark-0.3.2/development.md +89 -0
- flowmark-0.3.2/devtools/lint.py +46 -0
- flowmark-0.3.2/poetry.lock +778 -0
- flowmark-0.3.2/publishing.md +71 -0
- flowmark-0.3.2/pyproject.toml +138 -0
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/__init__.py +3 -2
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/cli.py +21 -5
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/frontmatter.py +1 -4
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/line_wrappers.py +6 -6
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/markdown_filling.py +18 -11
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/sentence_split_regex.py +4 -5
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/text_filling.py +6 -6
- {flowmark-0.3.0 → flowmark-0.3.2}/src/flowmark/text_wrapping.py +14 -14
- flowmark-0.3.2/tests/test_filling.py +287 -0
- flowmark-0.3.2/tests/test_frontmatter.py +72 -0
- flowmark-0.3.2/tests/test_ref_docs.py +47 -0
- flowmark-0.3.2/tests/test_wrapping.py +130 -0
- flowmark-0.3.2/tests/testdocs/testdoc.orig.md +593 -0
- flowmark-0.3.2/tests/testdocs/testdoc.out.plain.md +877 -0
- flowmark-0.3.2/tests/testdocs/testdoc.out.semantic.md +918 -0
- flowmark-0.3.2/uv.lock +356 -0
- flowmark-0.3.0/pyproject.toml +0 -102
- {flowmark-0.3.0 → flowmark-0.3.2}/LICENSE +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier. Do not edit manually.
|
|
2
|
+
_commit: v0.2.0
|
|
3
|
+
_src_path: gh:jlevy/simple-modern-uv
|
|
4
|
+
package_author_email: joshua@cal.berkeley.edu
|
|
5
|
+
package_author_name: Joshua Levy
|
|
6
|
+
package_description: Better line wrapping and formatting for plaintext and Markdown
|
|
7
|
+
package_github_org: jlevy
|
|
8
|
+
package_module: flowmark
|
|
9
|
+
package_name: flowmark
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
# Use ["main", "master"] for CI only on the default branch.
|
|
9
|
+
# Use ["**"] for CI on all branches.
|
|
10
|
+
branches: ["main", "master"]
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: ["main", "master"]
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
# Update this as needed:
|
|
22
|
+
|
|
23
|
+
# Common platforms: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
|
24
|
+
os: ["ubuntu-latest"]
|
|
25
|
+
python-version: ["3.10","3.11", "3.12", "3.13"]
|
|
26
|
+
|
|
27
|
+
# Linux only by default. Use ${{ matrix.os }} for other OSes.
|
|
28
|
+
runs-on: ${{ matrix.os }}
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
# Generally following uv docs:
|
|
32
|
+
# https://docs.astral.sh/uv/guides/integration/github/
|
|
33
|
+
|
|
34
|
+
- name: Checkout (official GitHub action)
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
# Important for versioning plugins:
|
|
38
|
+
fetch-depth: 0
|
|
39
|
+
|
|
40
|
+
- name: Install uv (official Astral action)
|
|
41
|
+
uses: astral-sh/setup-uv@v5
|
|
42
|
+
with:
|
|
43
|
+
version: "0.6.5"
|
|
44
|
+
enable-cache: true
|
|
45
|
+
python-version: ${{ matrix.python-version }}
|
|
46
|
+
|
|
47
|
+
- name: Set up Python (using uv)
|
|
48
|
+
run: uv python install
|
|
49
|
+
|
|
50
|
+
# Alternately can use the official Python action:
|
|
51
|
+
# - name: Set up Python (using actions/setup-python)
|
|
52
|
+
# uses: actions/setup-python@v5
|
|
53
|
+
# with:
|
|
54
|
+
# python-version: ${{ matrix.python-version }}
|
|
55
|
+
|
|
56
|
+
- name: Install all dependencies
|
|
57
|
+
run: uv sync --all-extras --dev
|
|
58
|
+
|
|
59
|
+
- name: Run linting
|
|
60
|
+
run: uv run python devtools/lint.py
|
|
61
|
+
|
|
62
|
+
- name: Run tests
|
|
63
|
+
run: uv run pytest
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch: # Enable manual trigger.
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # Mandatory for OIDC.
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout (official GitHub action)
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
# Important for versioning plugins:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Install uv (official Astral action)
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
with:
|
|
24
|
+
version: "0.6.5"
|
|
25
|
+
enable-cache: true
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- name: Set up Python (using uv)
|
|
29
|
+
run: uv python install
|
|
30
|
+
|
|
31
|
+
- name: Install all dependencies
|
|
32
|
+
run: uv sync --all-extras --dev
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest
|
|
36
|
+
|
|
37
|
+
- name: Build package
|
|
38
|
+
run: uv build
|
|
39
|
+
|
|
40
|
+
- name: Publish to PyPI (using uv)
|
|
41
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Additions to standard GitHub .gitignore:
|
|
2
|
+
*.bak
|
|
3
|
+
*.orig
|
|
4
|
+
tmp/
|
|
5
|
+
trash/
|
|
6
|
+
attic/
|
|
7
|
+
.kash/
|
|
8
|
+
|
|
9
|
+
# Byte-compiled / optimized / DLL files
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
*$py.class
|
|
13
|
+
|
|
14
|
+
# C extensions
|
|
15
|
+
*.so
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
.Python
|
|
19
|
+
build/
|
|
20
|
+
develop-eggs/
|
|
21
|
+
dist/
|
|
22
|
+
downloads/
|
|
23
|
+
eggs/
|
|
24
|
+
.eggs/
|
|
25
|
+
lib/
|
|
26
|
+
lib64/
|
|
27
|
+
parts/
|
|
28
|
+
sdist/
|
|
29
|
+
var/
|
|
30
|
+
wheels/
|
|
31
|
+
share/python-wheels/
|
|
32
|
+
*.egg-info/
|
|
33
|
+
.installed.cfg
|
|
34
|
+
*.egg
|
|
35
|
+
MANIFEST
|
|
36
|
+
|
|
37
|
+
# PyInstaller
|
|
38
|
+
# Usually these files are written by a python script from a template
|
|
39
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
40
|
+
*.manifest
|
|
41
|
+
*.spec
|
|
42
|
+
|
|
43
|
+
# Installer logs
|
|
44
|
+
pip-log.txt
|
|
45
|
+
pip-delete-this-directory.txt
|
|
46
|
+
|
|
47
|
+
# Unit test / coverage reports
|
|
48
|
+
htmlcov/
|
|
49
|
+
.tox/
|
|
50
|
+
.nox/
|
|
51
|
+
.coverage
|
|
52
|
+
.coverage.*
|
|
53
|
+
.cache
|
|
54
|
+
nosetests.xml
|
|
55
|
+
coverage.xml
|
|
56
|
+
*.cover
|
|
57
|
+
*.py,cover
|
|
58
|
+
.hypothesis/
|
|
59
|
+
.pytest_cache/
|
|
60
|
+
cover/
|
|
61
|
+
|
|
62
|
+
# Translations
|
|
63
|
+
*.mo
|
|
64
|
+
*.pot
|
|
65
|
+
|
|
66
|
+
# Django stuff:
|
|
67
|
+
*.log
|
|
68
|
+
local_settings.py
|
|
69
|
+
db.sqlite3
|
|
70
|
+
db.sqlite3-journal
|
|
71
|
+
|
|
72
|
+
# Flask stuff:
|
|
73
|
+
instance/
|
|
74
|
+
.webassets-cache
|
|
75
|
+
|
|
76
|
+
# Scrapy stuff:
|
|
77
|
+
.scrapy
|
|
78
|
+
|
|
79
|
+
# Sphinx documentation
|
|
80
|
+
docs/_build/
|
|
81
|
+
|
|
82
|
+
# PyBuilder
|
|
83
|
+
.pybuilder/
|
|
84
|
+
target/
|
|
85
|
+
|
|
86
|
+
# Jupyter Notebook
|
|
87
|
+
.ipynb_checkpoints
|
|
88
|
+
|
|
89
|
+
# IPython
|
|
90
|
+
profile_default/
|
|
91
|
+
ipython_config.py
|
|
92
|
+
|
|
93
|
+
# pyenv
|
|
94
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
95
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
96
|
+
# .python-version
|
|
97
|
+
|
|
98
|
+
# pipenv
|
|
99
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
100
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
101
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
102
|
+
# install all needed dependencies.
|
|
103
|
+
#Pipfile.lock
|
|
104
|
+
|
|
105
|
+
# UV
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
#uv.lock
|
|
110
|
+
|
|
111
|
+
# poetry
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
113
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
114
|
+
# commonly ignored for libraries.
|
|
115
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
116
|
+
#poetry.lock
|
|
117
|
+
|
|
118
|
+
# pdm
|
|
119
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
120
|
+
#pdm.lock
|
|
121
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
122
|
+
# in version control.
|
|
123
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
124
|
+
.pdm.toml
|
|
125
|
+
.pdm-python
|
|
126
|
+
.pdm-build/
|
|
127
|
+
|
|
128
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
129
|
+
__pypackages__/
|
|
130
|
+
|
|
131
|
+
# Celery stuff
|
|
132
|
+
celerybeat-schedule
|
|
133
|
+
celerybeat.pid
|
|
134
|
+
|
|
135
|
+
# SageMath parsed files
|
|
136
|
+
*.sage.py
|
|
137
|
+
|
|
138
|
+
# Environments
|
|
139
|
+
.env
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# PyPI configuration file
|
|
179
|
+
.pypirc
|
flowmark-0.3.2/Makefile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Makefile for easy development workflows.
|
|
2
|
+
# GitHub Actions call uv directly.
|
|
3
|
+
|
|
4
|
+
.DEFAULT_GOAL := default
|
|
5
|
+
|
|
6
|
+
.PHONY: default install lint test upgrade build clean gen_test_docs
|
|
7
|
+
|
|
8
|
+
default: install lint test
|
|
9
|
+
|
|
10
|
+
install:
|
|
11
|
+
uv sync --all-extras --dev
|
|
12
|
+
|
|
13
|
+
lint:
|
|
14
|
+
uv run python devtools/lint.py
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
uv run pytest
|
|
18
|
+
|
|
19
|
+
upgrade:
|
|
20
|
+
uv sync --upgrade
|
|
21
|
+
|
|
22
|
+
build:
|
|
23
|
+
uv build
|
|
24
|
+
|
|
25
|
+
clean:
|
|
26
|
+
-rm -rf dist/
|
|
27
|
+
-rm -rf *.egg-info/
|
|
28
|
+
-rm -rf .pytest_cache/
|
|
29
|
+
-rm -rf .mypy_cache/
|
|
30
|
+
-rm -rf .venv/
|
|
31
|
+
-find . -type d -name "__pycache__" -exec rm -rf {} +
|
|
32
|
+
|
|
33
|
+
gen_test_docs:
|
|
34
|
+
poetry run flowmark tests/testdocs/testdoc.orig.md -o tests/testdocs/testdoc.out.plain.md
|
|
35
|
+
poetry run flowmark --semantic tests/testdocs/testdoc.orig.md -o tests/testdocs/testdoc.out.semantic.md
|
|
@@ -1,15 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flowmark
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Better line wrapping and formatting for plaintext and Markdown
|
|
5
|
+
Project-URL: Repository, https://github.com/jlevy/flowmark
|
|
6
|
+
Author-email: Joshua Levy <joshua@cal.berkeley.edu>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: <4.0,>=3.10
|
|
10
|
+
Requires-Dist: marko>=2.1.2
|
|
11
|
+
Requires-Dist: regex>=2024.11.6
|
|
12
|
+
Requires-Dist: strif>=2.0.0
|
|
13
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
1
16
|
# flowmark
|
|
2
17
|
|
|
3
18
|
Flowmark is a new Python implementation of **text and Markdown line wrapping and
|
|
4
|
-
filling
|
|
19
|
+
filling**, with an emphasis on making **git diffs** and **LLM edits** to text documents
|
|
20
|
+
easier to diff and review.
|
|
21
|
+
after updating
|
|
5
22
|
|
|
6
|
-
In addition, it adds
|
|
7
|
-
|
|
8
|
-
[markdownfmt](https://github.com/shurcooL/markdownfmt) or
|
|
23
|
+
In addition, it adds **support for Markdown** and offers **Markdown auto-formatting and
|
|
24
|
+
normalization** as a library or from the command line.
|
|
25
|
+
This is much like [markdownfmt](https://github.com/shurcooL/markdownfmt) or
|
|
9
26
|
[prettier's Markdown support](https://prettier.io/blog/2017/11/07/1.8.0) but is pure
|
|
10
27
|
Python and has (in my humble opinion) better options and defaults.
|
|
11
28
|
|
|
12
|
-
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
The simplest way to use the tool is to use [uv](https://github.com/astral-sh/uv).
|
|
32
|
+
Then run `uvx flowmark --help`.
|
|
33
|
+
|
|
34
|
+
To install the command-line properly:
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
uv tool install flowmark
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or [pipx](https://github.com/pypa/pipx):
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
pipx install flowmark
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
flowmark --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To use as a library, use uv/poetry/pip to install
|
|
53
|
+
[`flowmark`](https://pypi.org/project/flowmark/).
|
|
54
|
+
|
|
55
|
+
## Use in VSCode/Cursor
|
|
56
|
+
|
|
57
|
+
You can use Flowmark to auto-format Markdown on save in VSCode or Cursor.
|
|
58
|
+
Install the "Run on Save" (`emeraldwalk.runonsave`) extension.
|
|
59
|
+
Then add to your `settings.json`:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
"emeraldwalk.runonsave": {
|
|
63
|
+
"commands": [
|
|
64
|
+
{
|
|
65
|
+
"match": "\\.md$",
|
|
66
|
+
"cmd": "flowmark --auto ${file}"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The `--auto` option is just the same as `--inplace --nobackup --semantic`.
|
|
73
|
+
|
|
74
|
+
## Use Cases
|
|
13
75
|
|
|
14
76
|
- As a **command line formatter** to format text or Markdown files using the `flowmark`
|
|
15
77
|
command.
|
|
@@ -53,49 +115,23 @@ It aims to be small and simple and have only a few dependencies, currently only
|
|
|
53
115
|
Because **YAML frontmatter** is common on Markdown files, the Markdown autoformat
|
|
54
116
|
preserves all frontmatter (content between `---` delimiters at the front of a file).
|
|
55
117
|
|
|
56
|
-
|
|
57
|
-
Previously I'd implemented something very similar with
|
|
58
|
-
[for Atom](https://github.com/jlevy/atom-flowmark) but Atom is no more and there seems
|
|
59
|
-
to be greater need for this in Python now.
|
|
60
|
-
From many years experience, I found the Markdown formatting conventions enforced by the
|
|
61
|
-
Atom Flowmark plugin worked well for editing and publishing large or collaboratively
|
|
62
|
-
edited documents.
|
|
63
|
-
|
|
64
|
-
## Installation
|
|
65
|
-
|
|
66
|
-
The simplest way to use the tool is to use [pipx](https://github.com/pypa/pipx):
|
|
67
|
-
|
|
68
|
-
```shell
|
|
69
|
-
pipx install flowmark
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Then
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
flowmark --help
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
To use as a library, use pip/poetry/uv to install
|
|
79
|
-
[`flowmark`](https://pypi.org/project/flowmark/).
|
|
118
|
+
## Why a New Markdown Formatter?
|
|
80
119
|
|
|
81
|
-
|
|
120
|
+
Previously I'd implemented something very similar with
|
|
121
|
+
[for Atom](https://github.com/jlevy/atom-flowmark).
|
|
122
|
+
I found the Markdown formatting conventions enforced by the that plugin worked really
|
|
123
|
+
well for editing and publishing large or collaboratively edited documents.
|
|
82
124
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Then add to your `settings.json`:
|
|
125
|
+
This is new, pure Python implementation.
|
|
126
|
+
There are numerous needs for a tool like this on the command line and in Python.
|
|
86
127
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
"match": "\\.md$",
|
|
92
|
-
"cmd": "flowmark --auto ${file}"
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
```
|
|
128
|
+
With LLM tools now using Markdown everywhere, there are enormous advantages to having
|
|
129
|
+
very clean and well-formatted Markdown documents, since you can then cleanly see diffs
|
|
130
|
+
or edits made by LLMs.
|
|
97
131
|
|
|
98
|
-
|
|
132
|
+
If you are in a workspace where you are editing lots of text, having them all be
|
|
133
|
+
Markdown with frontmatter, auto-formatted for every git commit makes for a *much* better
|
|
134
|
+
experience.
|
|
99
135
|
|
|
100
136
|
## Usage
|
|
101
137
|
|
|
@@ -127,6 +163,7 @@ Markdown content. It can:
|
|
|
127
163
|
|
|
128
164
|
- Optionally break lines at sentence boundaries for better diff readability
|
|
129
165
|
|
|
166
|
+
|
|
130
167
|
- Process plaintext with HTML-aware word splitting
|
|
131
168
|
|
|
132
169
|
It is both a library and a command-line tool.
|
|
@@ -152,7 +189,9 @@ Command-line usage examples:
|
|
|
152
189
|
For more details, see: https://github.com/jlevy/flowmark
|
|
153
190
|
```
|
|
154
191
|
|
|
192
|
+
For instructions on publishing to PyPI, see [publishing.md](publishing.md).
|
|
193
|
+
|
|
155
194
|
* * *
|
|
156
195
|
|
|
157
196
|
*This project was built from
|
|
158
|
-
[simple-modern-
|
|
197
|
+
[simple-modern-uv](https://github.com/jlevy/simple-modern-uv).*
|
|
@@ -1,34 +1,62 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: flowmark
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: Better line wrapping and formatting for plaintext and Markdown
|
|
5
|
-
License: MIT
|
|
6
|
-
Author: Joshua Levy
|
|
7
|
-
Author-email: joshua@cal.berkeley.edu
|
|
8
|
-
Requires-Python: >=3.10,<4.0
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Requires-Dist: marko (>=2.1.2,<3.0.0)
|
|
16
|
-
Requires-Dist: regex (>=2024.11.6,<2025.0.0)
|
|
17
|
-
Requires-Dist: strif (>=2.0.0,<3.0.0)
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
1
|
# flowmark
|
|
21
2
|
|
|
22
3
|
Flowmark is a new Python implementation of **text and Markdown line wrapping and
|
|
23
|
-
filling
|
|
4
|
+
filling**, with an emphasis on making **git diffs** and **LLM edits** to text documents
|
|
5
|
+
easier to diff and review.
|
|
6
|
+
after updating
|
|
24
7
|
|
|
25
|
-
In addition, it adds
|
|
26
|
-
|
|
27
|
-
[markdownfmt](https://github.com/shurcooL/markdownfmt) or
|
|
8
|
+
In addition, it adds **support for Markdown** and offers **Markdown auto-formatting and
|
|
9
|
+
normalization** as a library or from the command line.
|
|
10
|
+
This is much like [markdownfmt](https://github.com/shurcooL/markdownfmt) or
|
|
28
11
|
[prettier's Markdown support](https://prettier.io/blog/2017/11/07/1.8.0) but is pure
|
|
29
12
|
Python and has (in my humble opinion) better options and defaults.
|
|
30
13
|
|
|
31
|
-
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
The simplest way to use the tool is to use [uv](https://github.com/astral-sh/uv).
|
|
17
|
+
Then run `uvx flowmark --help`.
|
|
18
|
+
|
|
19
|
+
To install the command-line properly:
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
uv tool install flowmark
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or [pipx](https://github.com/pypa/pipx):
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
pipx install flowmark
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
flowmark --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
To use as a library, use uv/poetry/pip to install
|
|
38
|
+
[`flowmark`](https://pypi.org/project/flowmark/).
|
|
39
|
+
|
|
40
|
+
## Use in VSCode/Cursor
|
|
41
|
+
|
|
42
|
+
You can use Flowmark to auto-format Markdown on save in VSCode or Cursor.
|
|
43
|
+
Install the "Run on Save" (`emeraldwalk.runonsave`) extension.
|
|
44
|
+
Then add to your `settings.json`:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
"emeraldwalk.runonsave": {
|
|
48
|
+
"commands": [
|
|
49
|
+
{
|
|
50
|
+
"match": "\\.md$",
|
|
51
|
+
"cmd": "flowmark --auto ${file}"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The `--auto` option is just the same as `--inplace --nobackup --semantic`.
|
|
58
|
+
|
|
59
|
+
## Use Cases
|
|
32
60
|
|
|
33
61
|
- As a **command line formatter** to format text or Markdown files using the `flowmark`
|
|
34
62
|
command.
|
|
@@ -72,49 +100,23 @@ It aims to be small and simple and have only a few dependencies, currently only
|
|
|
72
100
|
Because **YAML frontmatter** is common on Markdown files, the Markdown autoformat
|
|
73
101
|
preserves all frontmatter (content between `---` delimiters at the front of a file).
|
|
74
102
|
|
|
75
|
-
|
|
76
|
-
Previously I'd implemented something very similar with
|
|
77
|
-
[for Atom](https://github.com/jlevy/atom-flowmark) but Atom is no more and there seems
|
|
78
|
-
to be greater need for this in Python now.
|
|
79
|
-
From many years experience, I found the Markdown formatting conventions enforced by the
|
|
80
|
-
Atom Flowmark plugin worked well for editing and publishing large or collaboratively
|
|
81
|
-
edited documents.
|
|
82
|
-
|
|
83
|
-
## Installation
|
|
84
|
-
|
|
85
|
-
The simplest way to use the tool is to use [pipx](https://github.com/pypa/pipx):
|
|
86
|
-
|
|
87
|
-
```shell
|
|
88
|
-
pipx install flowmark
|
|
89
|
-
```
|
|
103
|
+
## Why a New Markdown Formatter?
|
|
90
104
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
To use as a library, use pip/poetry/uv to install
|
|
98
|
-
[`flowmark`](https://pypi.org/project/flowmark/).
|
|
99
|
-
|
|
100
|
-
## Use in VSCode/Cursor
|
|
105
|
+
Previously I'd implemented something very similar with
|
|
106
|
+
[for Atom](https://github.com/jlevy/atom-flowmark).
|
|
107
|
+
I found the Markdown formatting conventions enforced by the that plugin worked really
|
|
108
|
+
well for editing and publishing large or collaboratively edited documents.
|
|
101
109
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Then add to your `settings.json`:
|
|
110
|
+
This is new, pure Python implementation.
|
|
111
|
+
There are numerous needs for a tool like this on the command line and in Python.
|
|
105
112
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
"match": "\\.md$",
|
|
111
|
-
"cmd": "flowmark --auto ${file}"
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
```
|
|
113
|
+
With LLM tools now using Markdown everywhere, there are enormous advantages to having
|
|
114
|
+
very clean and well-formatted Markdown documents, since you can then cleanly see diffs
|
|
115
|
+
or edits made by LLMs.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
If you are in a workspace where you are editing lots of text, having them all be
|
|
118
|
+
Markdown with frontmatter, auto-formatted for every git commit makes for a *much* better
|
|
119
|
+
experience.
|
|
118
120
|
|
|
119
121
|
## Usage
|
|
120
122
|
|
|
@@ -146,6 +148,7 @@ Markdown content. It can:
|
|
|
146
148
|
|
|
147
149
|
- Optionally break lines at sentence boundaries for better diff readability
|
|
148
150
|
|
|
151
|
+
|
|
149
152
|
- Process plaintext with HTML-aware word splitting
|
|
150
153
|
|
|
151
154
|
It is both a library and a command-line tool.
|
|
@@ -171,8 +174,9 @@ Command-line usage examples:
|
|
|
171
174
|
For more details, see: https://github.com/jlevy/flowmark
|
|
172
175
|
```
|
|
173
176
|
|
|
177
|
+
For instructions on publishing to PyPI, see [publishing.md](publishing.md).
|
|
178
|
+
|
|
174
179
|
* * *
|
|
175
180
|
|
|
176
181
|
*This project was built from
|
|
177
|
-
[simple-modern-
|
|
178
|
-
|
|
182
|
+
[simple-modern-uv](https://github.com/jlevy/simple-modern-uv).*
|