hongdown 0.3.0-dev.88 → 0.3.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.
- package/README.md +70 -11
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -161,9 +161,43 @@ These directives are merged with configuration file settings.
|
|
|
161
161
|
|
|
162
162
|
### Configuration file
|
|
163
163
|
|
|
164
|
-
Hongdown
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
Hongdown supports cascading configuration files from multiple locations.
|
|
165
|
+
Configuration files are loaded and merged in the following order (lowest to
|
|
166
|
+
highest priority):
|
|
167
|
+
|
|
168
|
+
1. **System-wide**: */etc/hongdown/config.toml* (Linux/Unix only)
|
|
169
|
+
2. **User (legacy)**: *~/.hongdown.toml* (all platforms)
|
|
170
|
+
3. **User (platform-specific)**:
|
|
171
|
+
- Linux: *$XDG\_CONFIG\_HOME/hongdown/config.toml* or
|
|
172
|
+
*~/.config/hongdown/config.toml*
|
|
173
|
+
- macOS: *~/Library/Application Support/hongdown/config.toml*
|
|
174
|
+
- Windows: *%APPDATA%\\hongdown\\config.toml*
|
|
175
|
+
4. **Project**: *.hongdown.toml* in the current directory or any parent
|
|
176
|
+
directory
|
|
177
|
+
|
|
178
|
+
Settings from higher-priority configurations override those from lower-priority
|
|
179
|
+
ones. This allows you to set global defaults at the user or system level while
|
|
180
|
+
overriding them for specific projects.
|
|
181
|
+
|
|
182
|
+
You can also specify a configuration file explicitly with the `--config` option,
|
|
183
|
+
which bypasses the cascading system and uses only that file.
|
|
184
|
+
|
|
185
|
+
#### Disabling configuration inheritance
|
|
186
|
+
|
|
187
|
+
To ignore all system and user configurations and use only your project config:
|
|
188
|
+
|
|
189
|
+
~~~~ toml
|
|
190
|
+
no_inherit = true
|
|
191
|
+
|
|
192
|
+
# Your project-specific settings
|
|
193
|
+
line_width = 100
|
|
194
|
+
~~~~
|
|
195
|
+
|
|
196
|
+
When `no_inherit = true`, only the project config and Hongdown's defaults are
|
|
197
|
+
used. This is useful for projects that need strict formatting control
|
|
198
|
+
regardless of user preferences.
|
|
199
|
+
|
|
200
|
+
#### Configuration options
|
|
167
201
|
|
|
168
202
|
Below is an example configuration with all available options and their
|
|
169
203
|
default values:
|
|
@@ -172,9 +206,10 @@ default values:
|
|
|
172
206
|
# File patterns (glob syntax)
|
|
173
207
|
include = [] # Files to format (default: none, specify on CLI)
|
|
174
208
|
exclude = [] # Files to skip (default: none)
|
|
209
|
+
git_aware = true # Respect .gitignore and skip .git directory (default: true)
|
|
175
210
|
|
|
176
211
|
# Formatting options
|
|
177
|
-
line_width = 80 # Maximum line width (default: 80)
|
|
212
|
+
line_width = 80 # Maximum line width (min: 8, default: 80)
|
|
178
213
|
|
|
179
214
|
[heading]
|
|
180
215
|
setext_h1 = true # Use === underline for h1 (default: true)
|
|
@@ -183,21 +218,21 @@ sentence_case = false # Convert headings to sentence case (default: false)
|
|
|
183
218
|
proper_nouns = [] # Additional proper nouns to preserve (default: [])
|
|
184
219
|
common_nouns = [] # Exclude built-in proper nouns (default: [])
|
|
185
220
|
|
|
186
|
-
[
|
|
221
|
+
[unordered_list]
|
|
187
222
|
unordered_marker = "-" # "-", "*", or "+" (default: "-")
|
|
188
|
-
leading_spaces = 1 # Spaces before marker (default: 1)
|
|
189
|
-
trailing_spaces = 2 # Spaces after marker (default: 2)
|
|
190
|
-
indent_width = 4 # Indentation for nested items (default: 4)
|
|
223
|
+
leading_spaces = 1 # Spaces before marker (0–3, default: 1)
|
|
224
|
+
trailing_spaces = 2 # Spaces after marker (0–3, default: 2)
|
|
225
|
+
indent_width = 4 # Indentation for nested items (min: 1, default: 4)
|
|
191
226
|
|
|
192
227
|
[ordered_list]
|
|
193
228
|
odd_level_marker = "." # "." or ")" at odd nesting levels (default: ".")
|
|
194
229
|
even_level_marker = ")" # "." or ")" at even nesting levels (default: ")")
|
|
195
230
|
pad = "start" # "start" or "end" for number alignment (default: "start")
|
|
196
|
-
indent_width = 4 # Indentation for nested items (default: 4)
|
|
231
|
+
indent_width = 4 # Indentation for nested items (min: 1, default: 4)
|
|
197
232
|
|
|
198
233
|
[code_block]
|
|
199
234
|
fence_char = "~" # "~" or "`" (default: "~")
|
|
200
|
-
min_fence_length = 4 # Minimum fence length (default: 4)
|
|
235
|
+
min_fence_length = 4 # Minimum fence length (min: 3, default: 4)
|
|
201
236
|
space_after_fence = true # Space between fence and language (default: true)
|
|
202
237
|
default_language = "" # Default language for code blocks (default: "")
|
|
203
238
|
|
|
@@ -206,8 +241,9 @@ default_language = "" # Default language for code blocks (default: "")
|
|
|
206
241
|
# javascript = ["deno", "fmt", "--ext=js", "-"]
|
|
207
242
|
|
|
208
243
|
[thematic_break]
|
|
244
|
+
# Must be valid CommonMark: at least 3 of *, -, or _ (with optional spaces)
|
|
209
245
|
style = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
210
|
-
leading_spaces = 3 # Leading spaces (0
|
|
246
|
+
leading_spaces = 3 # Leading spaces (0–3, default: 3)
|
|
211
247
|
|
|
212
248
|
[punctuation]
|
|
213
249
|
curly_double_quotes = true # "text" to "text" (default: true)
|
|
@@ -218,6 +254,14 @@ en_dash = false # Disabled by default (use "--" to enable)
|
|
|
218
254
|
em_dash = "--" # -- to --- (default: "--", use false to disable)
|
|
219
255
|
~~~~
|
|
220
256
|
|
|
257
|
+
Configuration values are validated at parse time. Invalid values will produce
|
|
258
|
+
descriptive error messages:
|
|
259
|
+
|
|
260
|
+
~~~~ bash
|
|
261
|
+
$ hongdown --config invalid.toml input.md
|
|
262
|
+
Error: failed to parse configuration file: line_width must be at least 8, got 5.
|
|
263
|
+
~~~~
|
|
264
|
+
|
|
221
265
|
When `include` patterns are configured, you can run Hongdown without
|
|
222
266
|
specifying files:
|
|
223
267
|
|
|
@@ -479,6 +523,21 @@ null_ls.register(hongdown)
|
|
|
479
523
|
[none-ls.nvim]: https://github.com/nvimtools/none-ls.nvim
|
|
480
524
|
[Vladimir Rubin]: https://github.com/dahlia/hongdown/issues/4
|
|
481
525
|
|
|
526
|
+
### Helix
|
|
527
|
+
|
|
528
|
+
If you use [Helix], you can register Hongdown as a formatter (contributed by
|
|
529
|
+
[Jean Simard]):
|
|
530
|
+
|
|
531
|
+
~~~~ toml
|
|
532
|
+
[[language]]
|
|
533
|
+
name = "markdown"
|
|
534
|
+
auto-format = true
|
|
535
|
+
formatter = { command = "hongdown", args = ["--stdin"] }
|
|
536
|
+
~~~~
|
|
537
|
+
|
|
538
|
+
[Helix]: https://helix-editor.com/
|
|
539
|
+
[Jean Simard]: https://github.com/dahlia/hongdown/pull/12
|
|
540
|
+
|
|
482
541
|
|
|
483
542
|
Library usage
|
|
484
543
|
-------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hongdown",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
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",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"node": "\u003e=18"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@hongdown/darwin-arm64": "0.3.0
|
|
31
|
-
"@hongdown/darwin-x64": "0.3.0
|
|
32
|
-
"@hongdown/linux-arm64": "0.3.0
|
|
33
|
-
"@hongdown/linux-x64": "0.3.0
|
|
34
|
-
"@hongdown/win32-arm64": "0.3.0
|
|
35
|
-
"@hongdown/win32-x64": "0.3.0
|
|
30
|
+
"@hongdown/darwin-arm64": "0.3.0",
|
|
31
|
+
"@hongdown/darwin-x64": "0.3.0",
|
|
32
|
+
"@hongdown/linux-arm64": "0.3.0",
|
|
33
|
+
"@hongdown/linux-x64": "0.3.0",
|
|
34
|
+
"@hongdown/win32-arm64": "0.3.0",
|
|
35
|
+
"@hongdown/win32-x64": "0.3.0"
|
|
36
36
|
}
|
|
37
37
|
}
|