Skip to content

Commit 605fbeb

Browse files
authored
Merge pull request #1 from neongreen/copilot/fix-b8ac6de0-e860-464f-9b6c-fa9022a5ffad
Add markdown-format: A Go-based markdown formatter with one sentence per line
2 parents 2e42c52 + 3466b61 commit 605fbeb

6 files changed

Lines changed: 1007 additions & 0 deletions

File tree

markdown-format/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Binaries
2+
markdown-format
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
9+
# Test binary
10+
*.test
11+
12+
# Output of go coverage tool
13+
*.out

markdown-format/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# markdown-format
2+
3+
A Go-based markdown formatter that reformats markdown files with one sentence per line.
4+
5+
## Features
6+
7+
- Uses [goldmark](https://github.com/yuin/goldmark), a well-maintained CommonMark-compliant markdown parser
8+
- Formats paragraphs with one sentence per line
9+
- Preserves markdown structure:
10+
- Headers
11+
- Lists (both ordered and unordered)
12+
- Code blocks (fenced and indented)
13+
- Blockquotes
14+
- Inline formatting (bold, italic, links, images, inline code)
15+
- Horizontal rules
16+
17+
## Why one sentence per line?
18+
19+
Formatting markdown with one sentence per line makes it easier to:
20+
- Track changes in version control (git diffs are clearer)
21+
- Review and edit individual sentences
22+
- Collaborate on documents
23+
24+
## Installation
25+
26+
```bash
27+
go build
28+
```
29+
30+
## Usage
31+
32+
Format a markdown file:
33+
34+
```bash
35+
./markdown-format input.md > output.md
36+
```
37+
38+
Read from stdin:
39+
40+
```bash
41+
cat input.md | ./markdown-format - > output.md
42+
```
43+
44+
## Example
45+
46+
Input:
47+
```markdown
48+
# Hello
49+
50+
This is a paragraph. It has multiple sentences. Let's format it!
51+
```
52+
53+
Output:
54+
```markdown
55+
# Hello
56+
57+
This is a paragraph.
58+
It has multiple sentences.
59+
Let's format it!
60+
```
61+
62+
## License
63+
64+
MIT License - See LICENSE file in the repository root.

markdown-format/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/neongreen/mono/markdown-format
2+
3+
go 1.24.7
4+
5+
require github.com/yuin/goldmark v1.7.13

markdown-format/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA=
2+
github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=

0 commit comments

Comments
 (0)