hongdown 0.2.0-dev.66 → 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 +42 -0
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -3,6 +3,7 @@ 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
@@ -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/
@@ -306,6 +309,8 @@ formatter (contributed by [Lee Dogeon][moreal zed]):
306
309
  Library usage
307
310
  -------------
308
311
 
312
+ ### Rust
313
+
309
314
  Hongdown can also be used as a Rust library:
310
315
 
311
316
  ~~~~ rust
@@ -317,6 +322,43 @@ let output = format(input, &options).unwrap();
317
322
  println!("{}", output);
318
323
  ~~~~
319
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
+
320
362
 
321
363
  Development
322
364
  -----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hongdown",
3
- "version": "0.2.0-dev.66+f2cdf12e",
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.66+f2cdf12e",
31
- "@hongdown/darwin-x64": "0.2.0-dev.66+f2cdf12e",
32
- "@hongdown/linux-arm64": "0.2.0-dev.66+f2cdf12e",
33
- "@hongdown/linux-x64": "0.2.0-dev.66+f2cdf12e",
34
- "@hongdown/win32-arm64": "0.2.0-dev.66+f2cdf12e",
35
- "@hongdown/win32-x64": "0.2.0-dev.66+f2cdf12e"
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
  }