hongdown 0.2.0-dev.65 → 0.2.0-dev.67

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 +69 -1
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -3,10 +3,11 @@ Hongdown
3
3
 
4
4
  [![crates.io][crates.io badge]][crates.io]
5
5
  [![npm][npm badge]][npm]
6
+ [![@hongdown/wasm][@hongdown/wasm badge]][@hongdown/wasm]
6
7
  [![GitHub Actions][GitHub Actions badge]][GitHub Actions]
7
8
 
8
9
  Hongdown is a Markdown formatter that enforces [Hong Minhee's Markdown
9
- style](./STYLE.md) conventions. The formatter is implemented in Rust using
10
+ style conventions](./STYLE.md). The formatter is implemented in Rust using
10
11
  the [Comrak] library for parsing. It produces consistently formatted Markdown
11
12
  output following a distinctive style used across multiple projects including
12
13
  [Fedify], [LogTape], and [Optique].
@@ -15,6 +16,8 @@ output following a distinctive style used across multiple projects including
15
16
  [crates.io]: https://crates.io/crates/hongdown
16
17
  [npm badge]: https://img.shields.io/npm/v/hongdown?logo=npm
17
18
  [npm]: https://www.npmjs.com/package/hongdown
19
+ [@hongdown/wasm badge]: https://img.shields.io/npm/v/@hongdown/wasm?logo=webassembly&label=%40hongdown%2Fwasm
20
+ [@hongdown/wasm]: https://www.npmjs.com/package/@hongdown/wasm
18
21
  [GitHub Actions badge]: https://github.com/dahlia/hongdown/actions/workflows/main.yaml/badge.svg
19
22
  [GitHub Actions]: https://github.com/dahlia/hongdown/actions/workflows/main.yaml
20
23
  [Comrak]: https://comrak.ee/
@@ -277,9 +280,37 @@ See *[STYLE.md](./STYLE.md)* for the complete style specification, including
277
280
  the philosophy behind these conventions and detailed formatting rules.
278
281
 
279
282
 
283
+ Editor integrations
284
+ -------------------
285
+
286
+ ### Zed
287
+
288
+ Add the following to your Zed settings to use Hongdown as the Markdown
289
+ formatter (contributed by [Lee Dogeon][moreal zed]):
290
+
291
+ ~~~~ json
292
+ {
293
+ "languages": {
294
+ "Markdown": {
295
+ "formatter": {
296
+ "external": {
297
+ "command": "hongdown",
298
+ "arguments": ["-"]
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ ~~~~
305
+
306
+ [moreal zed]: https://hackers.pub/@moreal/019bb141-dc94-7103-ab3d-779941125430
307
+
308
+
280
309
  Library usage
281
310
  -------------
282
311
 
312
+ ### Rust
313
+
283
314
  Hongdown can also be used as a Rust library:
284
315
 
285
316
  ~~~~ rust
@@ -291,6 +322,43 @@ let output = format(input, &options).unwrap();
291
322
  println!("{}", output);
292
323
  ~~~~
293
324
 
325
+ ### JavaScript/TypeScript
326
+
327
+ Hongdown is available as a WebAssembly-based library for JavaScript and
328
+ TypeScript:
329
+
330
+ ~~~~ bash
331
+ npm install @hongdown/wasm
332
+ ~~~~
333
+
334
+ ~~~~ typescript
335
+ import { format, formatWithWarnings } from "@hongdown/wasm";
336
+
337
+ // Basic usage
338
+ const markdown = "# Hello\nWorld";
339
+ const formatted = await format(markdown);
340
+
341
+ // With options
342
+ const result = await format(markdown, {
343
+ lineWidth: 100,
344
+ setextH1: false,
345
+ fenceChar: "`",
346
+ });
347
+
348
+ // Get warnings along with formatted output
349
+ const { output, warnings } = await formatWithWarnings(markdown);
350
+ if (warnings.length > 0) {
351
+ for (const warning of warnings) {
352
+ console.warn(`Line ${warning.line}: ${warning.message}`);
353
+ }
354
+ }
355
+ ~~~~
356
+
357
+ The library works in Node.js, Bun, Deno, and web browsers. See the
358
+ [TypeScript type definitions] for all available options.
359
+
360
+ [TypeScript type definitions]: ./npm/wasm/src/types.ts
361
+
294
362
 
295
363
  Development
296
364
  -----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hongdown",
3
- "version": "0.2.0-dev.65+7ac05d11",
3
+ "version": "0.2.0-dev.67+1efd4bb7",
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.65+7ac05d11",
31
- "@hongdown/darwin-x64": "0.2.0-dev.65+7ac05d11",
32
- "@hongdown/linux-arm64": "0.2.0-dev.65+7ac05d11",
33
- "@hongdown/linux-x64": "0.2.0-dev.65+7ac05d11",
34
- "@hongdown/win32-arm64": "0.2.0-dev.65+7ac05d11",
35
- "@hongdown/win32-x64": "0.2.0-dev.65+7ac05d11"
30
+ "@hongdown/darwin-arm64": "0.2.0-dev.67+1efd4bb7",
31
+ "@hongdown/darwin-x64": "0.2.0-dev.67+1efd4bb7",
32
+ "@hongdown/linux-arm64": "0.2.0-dev.67+1efd4bb7",
33
+ "@hongdown/linux-x64": "0.2.0-dev.67+1efd4bb7",
34
+ "@hongdown/win32-arm64": "0.2.0-dev.67+1efd4bb7",
35
+ "@hongdown/win32-x64": "0.2.0-dev.67+1efd4bb7"
36
36
  }
37
37
  }