hongdown 0.1.0-dev.3 → 0.1.0-dev.7

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.
Files changed (2) hide show
  1. package/README.md +310 -0
  2. package/package.json +8 -8
package/README.md ADDED
@@ -0,0 +1,310 @@
1
+ Hongdown
2
+ ========
3
+
4
+ Hongdown is a Markdown formatter that enforces Hong Minhee's Markdown style
5
+ conventions. The formatter is implemented in Rust using the [comrak] library
6
+ for parsing. It produces consistently formatted Markdown output following
7
+ a distinctive style used across multiple projects including [Fedify], [Hollo],
8
+ and [Vertana].
9
+
10
+ The name *Hongdown* is a portmanteau of *Hong* (from Hong Minhee, the author)
11
+ and *Markdown*. It also sounds like the Korean word *hongdapda* (홍답다),
12
+ meaning "befitting of Hong" or "Hong-like."
13
+
14
+ [comrak]: https://docs.rs/comrak
15
+ [Fedify]: https://github.com/dahlia/fedify
16
+ [Hollo]: https://github.com/dahlia/hollo
17
+ [Vertana]: https://github.com/dahlia/vertana
18
+
19
+
20
+ Installation
21
+ ------------
22
+
23
+ ### npm (Node.js)
24
+
25
+ ~~~~ bash
26
+ npm install -g hongdown
27
+ ~~~~
28
+
29
+ ### Cargo (Rust)
30
+
31
+ ~~~~ bash
32
+ cargo install hongdown
33
+ ~~~~
34
+
35
+ ### Pre-built binaries
36
+
37
+ Pre-built binaries for Linux, macOS, and Windows are available on the
38
+ [GitHub Releases] page.
39
+
40
+ [GitHub Releases]: https://github.com/dahlia/hongdown/releases
41
+
42
+
43
+ Usage
44
+ -----
45
+
46
+ ### Basic usage
47
+
48
+ ~~~~ bash
49
+ # Format a file and print to stdout
50
+ hongdown input.md
51
+
52
+ # Format a file in place
53
+ hongdown --write input.md
54
+ hongdown -w input.md
55
+
56
+ # Format multiple files
57
+ hongdown -w *.md
58
+
59
+ # Check if files are formatted (exit 1 if not)
60
+ hongdown --check input.md
61
+ hongdown -c input.md
62
+
63
+ # Show diff of formatting changes
64
+ hongdown --diff input.md
65
+ hongdown -d input.md
66
+
67
+ # Read from stdin
68
+ echo "# Hello" | hongdown
69
+ hongdown --stdin < input.md
70
+
71
+ # Custom line width
72
+ hongdown --line-width 100 input.md
73
+ ~~~~
74
+
75
+ ### Disable directives
76
+
77
+ Hongdown supports special HTML comments to disable formatting for specific
78
+ sections of your document:
79
+
80
+ ~~~~ markdown
81
+ <!-- hongdown-disable-file -->
82
+ This entire file will not be formatted.
83
+ ~~~~
84
+
85
+ ~~~~ markdown
86
+ <!-- hongdown-disable-next-line -->
87
+ This line preserves its spacing.
88
+
89
+ The next line will be formatted normally.
90
+ ~~~~
91
+
92
+ ~~~~ markdown
93
+ <!-- hongdown-disable-next-section -->
94
+ Everything here is preserved as-is
95
+ until the next heading (h1 or h2).
96
+
97
+ Next heading
98
+ ------------
99
+
100
+ This section will be formatted normally.
101
+ ~~~~
102
+
103
+ ~~~~ markdown
104
+ <!-- hongdown-disable -->
105
+ This section is not formatted.
106
+ <!-- hongdown-enable -->
107
+ This section is formatted again.
108
+ ~~~~
109
+
110
+ ### Configuration file
111
+
112
+ Hongdown looks for a `.hongdown.toml` file in the current directory and
113
+ parent directories. You can also specify a configuration file explicitly
114
+ with the `--config` option.
115
+
116
+ ~~~~ toml
117
+ # File patterns (glob syntax)
118
+ include = ["*.md", "docs/**/*.md"] # Files to format
119
+ exclude = ["node_modules/**"] # Files to skip
120
+
121
+ # Formatting options
122
+ line_width = 80
123
+
124
+ [heading]
125
+ setext_h1 = true # Use === underline for h1
126
+ setext_h2 = true # Use --- underline for h2
127
+
128
+ [list]
129
+ unordered_marker = "-" # "-", "*", or "+"
130
+ leading_spaces = 1 # Spaces before marker
131
+ trailing_spaces = 2 # Spaces after marker
132
+ indent_width = 4 # Indentation for nested items
133
+
134
+ [ordered_list]
135
+ odd_level_marker = "." # "1." at odd nesting levels
136
+ even_level_marker = ")" # "1)" at even nesting levels
137
+
138
+ [code_block]
139
+ fence_char = "~" # "~" or "`"
140
+ min_fence_length = 4 # Minimum fence length
141
+ space_after_fence = true # Space between fence and language
142
+ ~~~~
143
+
144
+ When `include` patterns are configured, you can run Hongdown without
145
+ specifying files:
146
+
147
+ ~~~~ bash
148
+ # Format all files matching include patterns
149
+ hongdown --write
150
+
151
+ # Check all files matching include patterns
152
+ hongdown --check
153
+ ~~~~
154
+
155
+ CLI options override configuration file settings:
156
+
157
+ ~~~~ bash
158
+ # Use config file but override line width
159
+ hongdown --line-width 100 input.md
160
+
161
+ # Use specific config file
162
+ hongdown --config /path/to/.hongdown.toml input.md
163
+ ~~~~
164
+
165
+
166
+ Style rules
167
+ -----------
168
+
169
+ Hongdown enforces the following conventions:
170
+
171
+ ### Headings
172
+
173
+ - Level 1 and 2 use Setext-style (underlined with `=` or `-`)
174
+ - Level 3+ use ATX-style (`###`, `####`, etc.)
175
+
176
+ ~~~~ markdown
177
+ Document Title
178
+ ==============
179
+
180
+ Section
181
+ -------
182
+
183
+ ### Subsection
184
+ ~~~~
185
+
186
+ ### Lists
187
+
188
+ - Unordered lists use ` - ` (space-hyphen-two spaces)
189
+ - Ordered lists use `1.` format
190
+ - 4-space indentation for nested items
191
+
192
+ ~~~~ markdown
193
+ - First item
194
+ - Second item
195
+ - Nested item
196
+ ~~~~
197
+
198
+ ### Code blocks
199
+
200
+ - Fenced with four tildes (`~~~~`)
201
+ - Language identifier on the opening fence
202
+
203
+ ~~~~~ text
204
+ ~~~~ rust
205
+ fn main() {
206
+ println!("Hello, world!");
207
+ }
208
+ ~~~~
209
+ ~~~~~
210
+
211
+ ### Line wrapping
212
+
213
+ - Lines wrap at approximately 80 display columns
214
+ - East Asian wide characters are counted as 2 columns
215
+ - Long words that cannot be broken are preserved
216
+
217
+ ### Links
218
+
219
+ - External URLs are converted to reference-style links
220
+ - References are placed at the end of each section
221
+ - Relative/local URLs remain inline
222
+
223
+ ~~~~ markdown
224
+ See the [documentation] for more details.
225
+
226
+ [documentation]: https://example.com/docs
227
+ ~~~~
228
+
229
+ ### Tables
230
+
231
+ - Pipes are aligned accounting for East Asian wide characters
232
+ - Minimum column width is maintained
233
+
234
+ See [SPEC.md] for the complete style specification.
235
+
236
+ [SPEC.md]: SPEC.md
237
+
238
+
239
+ Library usage
240
+ -------------
241
+
242
+ Hongdown can also be used as a Rust library:
243
+
244
+ ~~~~ rust
245
+ use hongdown::{format, Options};
246
+
247
+ let input = "# Hello World\nThis is a paragraph.";
248
+ let options = Options::default();
249
+ let output = format(input, &options).unwrap();
250
+ println!("{}", output);
251
+ ~~~~
252
+
253
+
254
+ TODO
255
+ ----
256
+
257
+ ### Phase 1: Core formatting
258
+
259
+ - [x] Basic CLI with file input/output
260
+ - [x] Front matter preservation (YAML/TOML)
261
+ - [x] Headings (setext and ATX)
262
+ - [x] Paragraphs with line wrapping
263
+ - [x] Lists (ordered and unordered)
264
+ - [x] Code blocks (fenced)
265
+ - [x] Block quotes
266
+ - [x] Inline formatting (emphasis, strong, code, links)
267
+ - [x] Basic test suite
268
+
269
+ ### Phase 2: Extended syntax
270
+
271
+ - [x] Tables with alignment
272
+ - [x] Definition lists
273
+ - [x] GitHub alerts/admonitions
274
+ - [x] Footnotes
275
+ - [x] Reference link collection and placement
276
+
277
+ ### Phase 3: Polish
278
+
279
+ - [x] Configuration file support
280
+ - [x] Config file parsing and discovery (`.hongdown.toml`)
281
+ - [x] `line_width` option
282
+ - [x] `[heading]` section
283
+ - [x] `setext_h1` option
284
+ - [x] `setext_h2` option
285
+ - [x] `[list]` section
286
+ - [x] `unordered_marker` option
287
+ - [x] `leading_spaces` option
288
+ - [x] `trailing_spaces` option
289
+ - [x] `indent_width` option
290
+ - [x] `[ordered_list]` section
291
+ - [x] `odd_level_marker` option
292
+ - [x] `even_level_marker` option
293
+ - [x] `[code_block]` section
294
+ - [x] `fence_char` option
295
+ - [x] `min_fence_length` option
296
+ - [x] `space_after_fence` option
297
+ - [x] Check mode for CI integration
298
+ - [x] Diff output mode
299
+ - [x] Disable directives
300
+ - [x] Edge case handling
301
+ - [ ] Performance optimization
302
+
303
+
304
+ License
305
+ -------
306
+
307
+ Distributed under the [GPL-3.0-or-later]. See [LICENSE] for more information.
308
+
309
+ [GPL-3.0-or-later]: https://www.gnu.org/licenses/gpl-3.0.html
310
+ [LICENSE]: LICENSE
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "hongdown",
3
- "version": "0.1.0-dev.3",
3
+ "version": "0.1.0-dev.7+6178b8ad",
4
4
  "type": "module",
5
5
  "description": "A Markdown formatter that enforces Hong Minhee's Markdown style conventions",
6
6
  "license": "GPL-3.0-or-later",
7
7
  "author": "Hong Minhee <hong@minhee.org>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/dahlia/hongdown"
10
+ "url": "git+https://github.com/dahlia/hongdown.git"
11
11
  },
12
12
  "homepage": "https://github.com/dahlia/hongdown",
13
13
  "keywords": [
@@ -27,11 +27,11 @@
27
27
  "node": ">=18"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@hongdown/darwin-arm64": "0.0.0",
31
- "@hongdown/darwin-x64": "0.0.0",
32
- "@hongdown/linux-arm64": "0.0.0",
33
- "@hongdown/linux-x64": "0.0.0",
34
- "@hongdown/win32-arm64": "0.0.0",
35
- "@hongdown/win32-x64": "0.0.0"
30
+ "@hongdown/darwin-arm64": "0.1.0-dev.7+6178b8ad",
31
+ "@hongdown/darwin-x64": "0.1.0-dev.7+6178b8ad",
32
+ "@hongdown/linux-arm64": "0.1.0-dev.7+6178b8ad",
33
+ "@hongdown/linux-x64": "0.1.0-dev.7+6178b8ad",
34
+ "@hongdown/win32-arm64": "0.1.0-dev.7+6178b8ad",
35
+ "@hongdown/win32-x64": "0.1.0-dev.7+6178b8ad"
36
36
  }
37
37
  }