Skip to content

Commit decc3f0

Browse files
committed
Update readme.
1 parent 8fc903c commit decc3f0

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

‎README.md‎

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ workflows, especially when committing documents to git repositories.
1010

1111
You can use Flowmark as a CLI, as an autoformatter in your IDE, or as a Python library.
1212

13+
It supports both [CommonMark](https://spec.commonmark.org/0.31.2/) and
14+
[GitHub-Flavored Markdown (GFM)](https://github.github.com/gfm/) via
15+
[Marko](https://github.com/frostming/marko).
16+
1317
The key differences from [other Markdown formatters](#why-another-markdown-formatter):
1418

1519
- Carefully chosen default formatting rules that are effective for use in editors/IDEs,
16-
in LLM pipelines (and also when paging through docs in a terminal), including
17-
normalizing all whitespace, headings, line wrapping, tables, and footnotes.
20+
in LLM pipelines, and also when paging through docs in a terminal.
21+
It parses and normalizes standard links and special characters, headings, tables,
22+
footnotes, and horizontal rules and performing Markdown-aware line wrapping.
1823

19-
- “Just works” support for GFM-style tables, footnotes, and YAML frontmatter.
24+
- “Just works” support for GFM-style tables, footnotes, and as YAML frontmatter.
2025

2126
- Advanced and customizable line-wrapping capabilities, including
2227
[semantic line breaks](#semantic-line-breaks), a feature that is especially helpful in
@@ -25,17 +30,20 @@ The key differences from [other Markdown formatters](#why-another-markdown-forma
2530
- Optional [automatic smart quotes](#smart-quote-support) for professional-looking
2631
typography.
2732

28-
Flowmark aims to be conservative about changes so that it is safe to run automatically
29-
on save or after any stage of a document pipeline.
33+
General philosophy:
3034

31-
It supports [CommonMark](https://spec.commonmark.org/0.31.2/) and
32-
[GitHub-Flavored Markdown (GFM)](https://github.github.com/gfm/) via
33-
[Marko](https://github.com/frostming/marko).
35+
- Be conservative about changes so that it is safe to run automatically on save or after
36+
any stage of a document pipeline.
37+
38+
- Be opinionated about sensible defaults but not dogmatic by preventing customization.
39+
You can adjust or disable most settings.
40+
And if you are using it as a library, you can fully control anything you want
41+
(including more complex things like custom line wrapping for HTML).
3442

35-
It aims to be small and simple and have only a few dependencies, currently
36-
[`marko`](https://github.com/frostming/marko),
37-
[`regex`](https://pypi.org/project/regex/), and
38-
[`strif`](https://github.com/jlevy/strif).
43+
- Be as small and simple as possible, with few dependencies:
44+
[`marko`](https://github.com/frostming/marko),
45+
[`regex`](https://pypi.org/project/regex/), and
46+
[`strif`](https://github.com/jlevy/strif).
3947

4048
## Installation
4149

@@ -62,10 +70,6 @@ The main ways to use Flowmark are:
6270

6371
- To **autoformat Markdown on save in VSCode/Cursor** or any other editor that supports
6472
running a command on save.
65-
Flowmark uses a readable format that makes diffs easy to read and use on GitHub.
66-
It also normalizes all Markdown syntax variations (such as different header or
67-
formatting styles). This can be especially useful for documentation and editing
68-
workflows where clean diffs and minimal merge conflicts on GitHub are important.
6973
See [below](#use-in-vscodecursor) for recommended VSCode/Cursor setup.
7074

7175
- As a **command line formatter** to format text or Markdown files using the `flowmark`
@@ -94,12 +98,14 @@ The main ways to use Flowmark are:
9498
> of this readme file.
9599
96100
Some Markdown auto-formatters never wrap lines, while others wrap at a fixed width.
97-
98101
Flowmark supports both, via the `--width` option.
99-
Default behavior is **88 columns** (like Black and a few other tools).
100102

101-
However, unlike traditional formatters, Flowmark also offers the option to use a
102-
heuristic that prefers line breaks at sentence boundaries.
103+
Default line wrapping behavior is **88 columns**. The “[90-ish
104+
columns](https://youtu.be/esZLCuWs_2Y?si=lUj055ROI--6tVU8&t=1288)” compromise was
105+
popularized by Black and also works well for Markdown.
106+
107+
However, in addition, unlike traditional formatters, Flowmark also offers the option to
108+
use a heuristic that prefers line breaks at sentence boundaries.
103109
This is a small change that can dramatically improve diff readability when collaborating
104110
or working with AI tools.
105111

@@ -111,16 +117,18 @@ and sometimes controversial.
111117
However, now we are using versioned Markdown more than ever, it’s a good time to revisit
112118
this idea, as it can **make diffs in git much more readable**. The change may seem
113119
subtle but avoids having paragraphs reflow for very small edits, which does a lot to
114-
**minimize merge conflicts**.
120+
**minimize merge conflicts**.
115121

116-
This is my own refinement of the (fairly loose) [semantic line break
117-
specification](https://github.com/sembr/specification).
118-
Instead of just allowing you to break lines as you wish, it simply auto-applies fixed
119-
conventions about likely sentence boundaries in a reasonable way.
120-
It uses very simple and fast **regex-based sentence splitting**. While not perfect, this
122+
This is my own refinement of [traditional semantic line breaks](https://github.com/sembr/specification).
123+
Instead of just allowing you to break lines as you wish, it auto-applies fixed
124+
conventions about likely sentence boundaries in a conservative and reasonable way.
125+
It uses simple and fast **regex-based sentence splitting**. While not perfect, this
121126
works well for these purposes (and is much faster and simpler than a proper sentence
122127
parser like SpaCy). It should work fine for English and many other Latin/Cyrillic
123128
languages, but hasn’t been tested on CJK.
129+
You can see some
130+
[old discussion](https://github.com/shurcooL/markdownfmt/issues/17) of this idea with
131+
the markdownfmt author.
124132

125133
While this approach to line wrapping may not be familiar, I suggest you just try
126134
`flowmark --auto` on a document and you will begin to see the benefits as you
@@ -252,7 +260,7 @@ There are several other Markdown auto-formatters:
252260
- [mdformat](https://github.com/executablebooks/mdformat) is probably the closest
253261
alternative to Flowmark and it also uses Python.
254262
It preserves line breaks in order to support semantic line breaks, but does not
255-
auto-apply them as Flowmark does.
263+
auto-apply them as Flowmark does and has somewhat different features.
256264

257265
- [Prettier](https://prettier.io/blog/2017/11/07/1.8.0) is the ubiquitous Node formatter
258266
that handles Markdown/MDX

0 commit comments

Comments
 (0)