You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,16 +33,21 @@ The `onesentence` tool provides a command-line interface for checking and fixing
33
33
#### Commands
34
34
35
35
```bash
36
-
onesentence check <file_path>
36
+
onesentence check <file_path> [<file_path> ...]
37
37
```
38
38
39
-
This command checks if the specified file adheres to the "one sentence per line" rule. It will return a non-zero exit code if any violations are found.
39
+
This command checks whether each given file adheres to the "one sentence per line" rule.
40
+
One or more files may be passed (for example, the filenames pre-commit hands to a hook).
41
+
It returns a non-zero exit code if any file has a violation.
This command corrects the specified file by splitting lines with multiple sentences into separate lines. If a dest_path is provided, the corrected file will be written to that path; otherwise, the original file will be overwritten.
47
+
This command corrects each given file by splitting lines with multiple sentences onto separate lines.
48
+
By default every file is corrected in place, so processing many files never lets one file overwrite another.
49
+
Pass `--output <path>` to write a single corrected file to a separate destination; this is only valid with exactly one input file.
50
+
It returns a non-zero exit code if any file required changes.
46
51
47
52
## Pre-commit hook
48
53
@@ -51,10 +56,28 @@ Install this pre-commit hook into your project with a block like the following:
51
56
```yaml
52
57
repos:
53
58
- repo: https://github.com/CU-DBMI/onesentence
54
-
rev: v0.0.1
59
+
rev: v0.1.1
55
60
hooks:
56
61
# run checks
57
62
- id: check
58
63
# run checks and fixes where possible
59
64
- id: fix
60
65
```
66
+
67
+
### Using onesentence with a Markdown formatter
68
+
69
+
If you also run a Markdown formatter such as
70
+
[`mdformat`](https://github.com/executablebooks/mdformat), configure it to
71
+
preserve existing line breaks so it does not undo the one-sentence-per-line
72
+
splitting.
73
+
For `mdformat` this means using `--wrap=keep` (the default), and notably **not**
74
+
`--wrap=no`or a fixed wrap width, either of which would rejoin sentences onto a
0 commit comments