hongdown 0.2.0-dev.75 → 0.2.0-dev.78

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 +79 -3
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -99,10 +99,14 @@ hongdown - < input.md
99
99
  hongdown --line-width 100 input.md
100
100
  ~~~~
101
101
 
102
- ### Disable directives
102
+ ### HTML comment directives
103
103
 
104
- Hongdown supports special HTML comments to disable formatting for specific
105
- sections of your document:
104
+ Hongdown supports special HTML comment directives to control formatting
105
+ behavior within documents.
106
+
107
+ #### Disable formatting
108
+
109
+ You can disable formatting for specific sections:
106
110
 
107
111
  ~~~~ markdown
108
112
  <!-- hongdown-disable-file -->
@@ -134,6 +138,27 @@ This section is not formatted.
134
138
  This section is formatted again.
135
139
  ~~~~
136
140
 
141
+ #### Sentence case customization
142
+
143
+ When sentence case is enabled, you can define document-specific proper nouns
144
+ and common nouns:
145
+
146
+ ~~~~ markdown
147
+ <!-- hongdown-proper-nouns: Swift, Go -->
148
+ <!-- hongdown-common-nouns: Python -->
149
+
150
+ # Using Swift And Go For Python Development
151
+
152
+ This heading will be formatted as: "Using Swift and Go for python development"
153
+ ~~~~
154
+
155
+ - `<!-- hongdown-proper-nouns: Word1, Word2 -->` – Defines proper nouns to
156
+ preserve (case-sensitive)
157
+ - `<!-- hongdown-common-nouns: Word1, Word2 -->` – Overrides built-in proper
158
+ nouns by treating them as common nouns
159
+
160
+ These directives are merged with configuration file settings.
161
+
137
162
  ### Configuration file
138
163
 
139
164
  Hongdown looks for a *.hongdown.toml* file in the current directory and
@@ -154,6 +179,9 @@ line_width = 80 # Maximum line width (default: 80)
154
179
  [heading]
155
180
  setext_h1 = true # Use === underline for h1 (default: true)
156
181
  setext_h2 = true # Use --- underline for h2 (default: true)
182
+ sentence_case = false # Convert headings to sentence case (default: false)
183
+ proper_nouns = [] # Additional proper nouns to preserve (default: [])
184
+ common_nouns = [] # Exclude built-in proper nouns (default: [])
157
185
 
158
186
  [list]
159
187
  unordered_marker = "-" # "-", "*", or "+" (default: "-")
@@ -217,6 +245,7 @@ Hongdown enforces the following conventions:
217
245
 
218
246
  - Level 1 and 2 use Setext-style (underlined with `=` or `-`)
219
247
  - Level 3+ use ATX-style (`###`, `####`, etc.)
248
+ - Optional sentence case conversion (disabled by default)
220
249
 
221
250
  ~~~~ markdown
222
251
  Document Title
@@ -228,6 +257,53 @@ Section
228
257
  ### Subsection
229
258
  ~~~~
230
259
 
260
+ #### Sentence case (optional)
261
+
262
+ When `sentence_case = true` is set in the configuration, Hongdown automatically
263
+ converts headings to sentence case using intelligent heuristics:
264
+
265
+ ~~~~ markdown
266
+ # Development Commands → Development commands
267
+ # Working With JSON APIs → Working with JSON APIs
268
+ # Using `MyClass` In Code → Using `MyClass` in code
269
+ ~~~~
270
+
271
+ The converter:
272
+
273
+ - Capitalizes only the first word
274
+ - Preserves code spans (text in backticks)
275
+ - Preserves acronyms (2+ consecutive uppercase letters, e.g., `API`, `HTTP`)
276
+ - Preserves proper nouns (built-in list + user-configured)
277
+ - Handles hyphenated words (e.g., `JSON-RPC`)
278
+ - Respects quoted text capitalization
279
+ - Preserves non-Latin scripts (CJK, etc.)
280
+
281
+ You can add custom proper nouns to preserve:
282
+
283
+ ~~~~ toml
284
+ [heading]
285
+ sentence_case = true
286
+ proper_nouns = ["MyCompany", "MyProduct", "MyAPI"]
287
+ ~~~~
288
+
289
+ You can also exclude built-in proper nouns by treating them as common nouns.
290
+ This is useful for words like “Go” which can be either a programming language
291
+ or a common verb:
292
+
293
+ ~~~~ toml
294
+ [heading]
295
+ sentence_case = true
296
+ common_nouns = ["Go", "Swift"] # Treat these as common nouns, not proper nouns
297
+ ~~~~
298
+
299
+ Built-in proper nouns include ~450 entries: programming languages (JavaScript,
300
+ TypeScript, Python, Rust, Go), technologies (GitHub, Docker, React, Node.js),
301
+ databases (PostgreSQL, MySQL, MongoDB), countries (United States, Republic of
302
+ Korea), natural languages (English, Korean, Japanese), and more.
303
+
304
+ You can also use HTML comment directives to define document-specific proper
305
+ nouns and common nouns. See the “HTML comment directives” section for details.
306
+
231
307
  ### Lists
232
308
 
233
309
  - Unordered lists use ` - ` (space-hyphen-two spaces)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hongdown",
3
- "version": "0.2.0-dev.75+6d4f84bb",
3
+ "version": "0.2.0-dev.78+569a02cd",
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.2.0-dev.75+6d4f84bb",
31
- "@hongdown/darwin-x64": "0.2.0-dev.75+6d4f84bb",
32
- "@hongdown/linux-arm64": "0.2.0-dev.75+6d4f84bb",
33
- "@hongdown/linux-x64": "0.2.0-dev.75+6d4f84bb",
34
- "@hongdown/win32-arm64": "0.2.0-dev.75+6d4f84bb",
35
- "@hongdown/win32-x64": "0.2.0-dev.75+6d4f84bb"
30
+ "@hongdown/darwin-arm64": "0.2.0-dev.78+569a02cd",
31
+ "@hongdown/darwin-x64": "0.2.0-dev.78+569a02cd",
32
+ "@hongdown/linux-arm64": "0.2.0-dev.78+569a02cd",
33
+ "@hongdown/linux-x64": "0.2.0-dev.78+569a02cd",
34
+ "@hongdown/win32-arm64": "0.2.0-dev.78+569a02cd",
35
+ "@hongdown/win32-x64": "0.2.0-dev.78+569a02cd"
36
36
  }
37
37
  }