hongdown 0.1.0-dev.8 → 0.1.0

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 +75 -30
  2. package/package.json +35 -35
package/README.md CHANGED
@@ -5,11 +5,11 @@ Hongdown
5
5
  [![npm][npm badge]][npm]
6
6
  [![GitHub Actions][GitHub Actions badge]][GitHub Actions]
7
7
 
8
- Hongdown is a Markdown formatter that enforces [Hong Minhee's Markdown style]
9
- conventions. The formatter is implemented in Rust using the [Comrak] library
10
- for parsing. It produces consistently formatted Markdown output following
11
- a distinctive style used across multiple projects including [Fedify], [LogTape],
12
- and [Optique].
8
+ Hongdown is a Markdown formatter that enforces [Hong Minhee's Markdown
9
+ style](./STYLE.md) conventions. The formatter is implemented in Rust using
10
+ the [Comrak] library for parsing. It produces consistently formatted Markdown
11
+ output following a distinctive style used across multiple projects including
12
+ [Fedify], [LogTape], and [Optique].
13
13
 
14
14
  [crates.io badge]: https://img.shields.io/crates/v/hongdown?logo=rust
15
15
  [crates.io]: https://crates.io/crates/hongdown
@@ -17,7 +17,6 @@ and [Optique].
17
17
  [npm]: https://www.npmjs.com/package/hongdown
18
18
  [GitHub Actions badge]: https://github.com/dahlia/hongdown/actions/workflows/main.yaml/badge.svg
19
19
  [GitHub Actions]: https://github.com/dahlia/hongdown/actions/workflows/main.yaml
20
- [Hong Minhee's Markdown style]: ./AGENTS.md#markdown-style-guide
21
20
  [Comrak]: https://comrak.ee/
22
21
  [Fedify]: https://fedify.dev/
23
22
  [LogTape]: https://logtape.org/
@@ -36,7 +35,7 @@ npm install -g hongdown
36
35
  ### mise
37
36
 
38
37
  ~~~~ bash
39
- mise use github:dahlia/hongdown
38
+ mise use -g github:dahlia/hongdown
40
39
  ~~~~
41
40
 
42
41
  ### Cargo
@@ -77,9 +76,11 @@ hongdown -c input.md
77
76
  hongdown --diff input.md
78
77
  hongdown -d input.md
79
78
 
80
- # Read from stdin
81
- echo "# Hello" | hongdown
79
+ # Read from stdin (use --stdin flag or - as filename)
80
+ echo "# Hello" | hongdown --stdin
81
+ echo "# Hello" | hongdown -
82
82
  hongdown --stdin < input.md
83
+ hongdown - < input.md
83
84
 
84
85
  # Custom line width
85
86
  hongdown --line-width 100 input.md
@@ -122,38 +123,46 @@ This section is formatted again.
122
123
 
123
124
  ### Configuration file
124
125
 
125
- Hongdown looks for a `.hongdown.toml` file in the current directory and
126
+ Hongdown looks for a *.hongdown.toml* file in the current directory and
126
127
  parent directories. You can also specify a configuration file explicitly
127
128
  with the `--config` option.
128
129
 
130
+ Below is an example configuration with all available options and their
131
+ default values:
132
+
129
133
  ~~~~ toml
130
134
  # File patterns (glob syntax)
131
- include = ["*.md", "docs/**/*.md"] # Files to format
132
- exclude = ["node_modules/**"] # Files to skip
135
+ include = [] # Files to format (default: none, specify on CLI)
136
+ exclude = [] # Files to skip (default: none)
133
137
 
134
138
  # Formatting options
135
- line_width = 80
139
+ line_width = 80 # Maximum line width (default: 80)
136
140
 
137
141
  [heading]
138
- setext_h1 = true # Use === underline for h1
139
- setext_h2 = true # Use --- underline for h2
142
+ setext_h1 = true # Use === underline for h1 (default: true)
143
+ setext_h2 = true # Use --- underline for h2 (default: true)
140
144
 
141
145
  [list]
142
- unordered_marker = "-" # "-", "*", or "+"
143
- leading_spaces = 1 # Spaces before marker
144
- trailing_spaces = 2 # Spaces after marker
145
- indent_width = 4 # Indentation for nested items
146
+ unordered_marker = "-" # "-", "*", or "+" (default: "-")
147
+ leading_spaces = 1 # Spaces before marker (default: 1)
148
+ trailing_spaces = 2 # Spaces after marker (default: 2)
149
+ indent_width = 4 # Indentation for nested items (default: 4)
146
150
 
147
151
  [ordered_list]
148
- odd_level_marker = "." # "1." at odd nesting levels
149
- even_level_marker = ")" # "1)" at even nesting levels
150
- pad = "start" # "start" or "end" for number alignment
151
- indent_width = 4 # Indentation for nested items
152
+ odd_level_marker = "." # "." or ")" at odd nesting levels (default: ".")
153
+ even_level_marker = ")" # "." or ")" at even nesting levels (default: ")")
154
+ pad = "start" # "start" or "end" for number alignment (default: "start")
155
+ indent_width = 4 # Indentation for nested items (default: 4)
152
156
 
153
157
  [code_block]
154
- fence_char = "~" # "~" or "`"
155
- min_fence_length = 4 # Minimum fence length
156
- space_after_fence = true # Space between fence and language
158
+ fence_char = "~" # "~" or "`" (default: "~")
159
+ min_fence_length = 4 # Minimum fence length (default: 4)
160
+ space_after_fence = true # Space between fence and language (default: true)
161
+ default_language = "" # Default language for code blocks (default: "")
162
+
163
+ [thematic_break]
164
+ style = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
165
+ leading_spaces = 3 # Leading spaces (0-3, default: 3)
157
166
  ~~~~
158
167
 
159
168
  When `include` patterns are configured, you can run Hongdown without
@@ -207,7 +216,7 @@ Section
207
216
  ~~~~ markdown
208
217
  - First item
209
218
  - Second item
210
- - Nested item
219
+ - Nested item
211
220
  ~~~~
212
221
 
213
222
  ### Code blocks
@@ -246,9 +255,8 @@ See the [documentation] for more details.
246
255
  - Pipes are aligned accounting for East Asian wide characters
247
256
  - Minimum column width is maintained
248
257
 
249
- See [SPEC.md] for the complete style specification.
250
-
251
- [SPEC.md]: SPEC.md
258
+ See *[STYLE.md](./STYLE.md)* for the complete style specification, including
259
+ the philosophy behind these conventions and detailed formatting rules.
252
260
 
253
261
 
254
262
  Library usage
@@ -266,6 +274,43 @@ println!("{}", output);
266
274
  ~~~~
267
275
 
268
276
 
277
+ Development
278
+ -----------
279
+
280
+ This project uses [mise] for task management.
281
+
282
+ [mise]: https://mise.jdx.dev/
283
+
284
+ ### Initial setup
285
+
286
+ After cloning the repository, set up the Git pre-commit hook to automatically
287
+ run quality checks before each commit:
288
+
289
+ ~~~~ bash
290
+ mise generate git-pre-commit --task=check --write
291
+ ~~~~
292
+
293
+ ### Quality checks
294
+
295
+ The following tasks are available:
296
+
297
+ ~~~~ bash
298
+ # Run all quality checks
299
+ mise run check
300
+
301
+ # Individual checks
302
+ mise run check:clippy # Run clippy linter
303
+ mise run check:fmt # Check code formatting
304
+ mise run check:type # Run Rust type checking
305
+ mise run check:markdown # Check Markdown formatting
306
+ ~~~~
307
+
308
+ See *[AGENTS.md]* for detailed development guidelines including TDD
309
+ practices, code style conventions, and commit message guidelines.
310
+
311
+ [AGENTS.md]: ./AGENTS.md
312
+
313
+
269
314
  Etymology
270
315
  ---------
271
316
 
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
- "name": "hongdown",
3
- "version": "0.1.0-dev.8+4f6b2b27",
4
- "type": "module",
5
- "description": "A Markdown formatter that enforces Hong Minhee's Markdown style conventions",
6
- "license": "GPL-3.0-or-later",
7
- "author": "Hong Minhee <hong@minhee.org>",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/dahlia/hongdown.git"
11
- },
12
- "homepage": "https://github.com/dahlia/hongdown",
13
- "keywords": [
14
- "markdown",
15
- "formatter",
16
- "linter",
17
- "style"
18
- ],
19
- "bin": {
20
- "hongdown": "bin/hongdown.js"
21
- },
22
- "files": [
23
- "bin/",
24
- "README.md"
25
- ],
26
- "engines": {
27
- "node": ">=18"
28
- },
29
- "optionalDependencies": {
30
- "@hongdown/darwin-arm64": "0.1.0-dev.8+4f6b2b27",
31
- "@hongdown/darwin-x64": "0.1.0-dev.8+4f6b2b27",
32
- "@hongdown/linux-arm64": "0.1.0-dev.8+4f6b2b27",
33
- "@hongdown/linux-x64": "0.1.0-dev.8+4f6b2b27",
34
- "@hongdown/win32-arm64": "0.1.0-dev.8+4f6b2b27",
35
- "@hongdown/win32-x64": "0.1.0-dev.8+4f6b2b27"
36
- }
2
+ "name": "hongdown",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "A Markdown formatter that enforces Hong Minhee's Markdown style conventions",
6
+ "license": "GPL-3.0-or-later",
7
+ "author": "Hong Minhee \u003chong@minhee.org\u003e",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/dahlia/hongdown.git"
11
+ },
12
+ "homepage": "https://github.com/dahlia/hongdown",
13
+ "keywords": [
14
+ "markdown",
15
+ "formatter",
16
+ "linter",
17
+ "style"
18
+ ],
19
+ "bin": {
20
+ "hongdown": "bin/hongdown.js"
21
+ },
22
+ "files": [
23
+ "bin/",
24
+ "README.md"
25
+ ],
26
+ "engines": {
27
+ "node": "\u003e=18"
28
+ },
29
+ "optionalDependencies": {
30
+ "@hongdown/darwin-arm64": "0.1.0",
31
+ "@hongdown/darwin-x64": "0.1.0",
32
+ "@hongdown/linux-arm64": "0.1.0",
33
+ "@hongdown/linux-x64": "0.1.0",
34
+ "@hongdown/win32-arm64": "0.1.0",
35
+ "@hongdown/win32-x64": "0.1.0"
36
+ }
37
37
  }