@headwall/markdown-to-blocks 1.1.1 → 1.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/CHANGELOG.md CHANGED
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.0] - 2026-10-06
11
+
12
+ ### Fixed
13
+
14
+ - CLI output written to a pipe (`md2blocks -i post.md | …`, `$(md2blocks …)`,
15
+ `child_process`) was silently cut off at 64 KB with exit code 0, because the
16
+ CLI called `process.exit()` before stdout had drained. Output to a file or
17
+ via `-o` was unaffected. The CLI now sets `process.exitCode` and lets stdout
18
+ drain.
19
+
20
+ ### Changed
21
+
22
+ - **Require Node ≥ 22** (was ≥ 20). Node 20 is end-of-life; CI now tests
23
+ Node 22 and 24, and the build targets `node22`.
24
+ - When the reader closes the pipe early (`md2blocks … | head`), the CLI exits
25
+ quietly with code 141, as a SIGPIPE-killed process would, so `set -o pipefail`
26
+ scripts can detect the incomplete output.
27
+ - Bundled `yaml` updated to 2.9.1. Output is now validated against
28
+ `@wordpress/block-library` 11 and `@wordpress/blocks` 16 (dev-only).
29
+
30
+ ## [1.2.0] - 2026-07-05
31
+
32
+ ### Added
33
+
34
+ - `headingAnchors` option (CLI `--heading-anchors`): derive an `id` (WordPress
35
+ `anchor` attribute) for each heading from its text, so in-page anchor links
36
+ work. GitHub-style slugs, de-duplicated per document (`overview`,
37
+ `overview-1`, …); a heading that slugs to nothing (only punctuation/emoji)
38
+ gets no `id`. Off by default. Output matches core's serialiser byte-for-byte
39
+ (including `--` attribute escaping) and validates against the
40
+ WordPress parser.
41
+
10
42
  ## [1.1.1] - 2026-06-29
11
43
 
12
44
  ### Fixed
@@ -66,7 +98,9 @@ parser and confirmed to import into the block editor with no recovery prompts.
66
98
  - ESM-only. Requires Node ≥ 18.
67
99
  - Zero runtime dependencies — all bundled into the published package.
68
100
 
69
- [Unreleased]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.1...HEAD
101
+ [Unreleased]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.3.0...HEAD
102
+ [1.3.0]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.2.0...v1.3.0
103
+ [1.2.0]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.1...v1.2.0
70
104
  [1.1.1]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.0...v1.1.1
71
105
  [1.1.0]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.0.0...v1.1.0
72
106
  [1.0.0]: https://github.com/headwalluk/markdown-to-blocks/releases/tag/v1.0.0
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  npm install -g @headwall/markdown-to-blocks
26
26
  ```
27
27
 
28
- This puts the `md2blocks` command on your `PATH`. Requires **Node ≥ 20**.
28
+ This puts the `md2blocks` command on your `PATH`. Requires **Node ≥ 22**.
29
29
 
30
30
  ### As a library
31
31
 
@@ -102,6 +102,7 @@ Modes:
102
102
  Conversion options:
103
103
  --heading-shift <n> Shift all heading levels by n (default 0)
104
104
  --min-heading-level <n> Clamp heading levels to [n, 6] (default 2)
105
+ --heading-anchors Add an id/anchor to each heading from its text
105
106
  --code-language <mode> 'drop' (default) or 'class' (emit language-xxx)
106
107
  --unsupported <mode> 'html' (default, wrap in core/html) or 'skip'
107
108
  --no-gfm Disable GFM (tables, strikethrough, autolinks)
@@ -161,6 +162,7 @@ Body text.
161
162
  |---|---|---|---|
162
163
  | `headingShift` | `number` | `0` | Shift every heading level by this amount before clamping. |
163
164
  | `minHeadingLevel` | `number` | `2` | Clamp resulting heading levels into `[min, 6]`. The default of `2` keeps body content from emitting an `h1`. |
165
+ | `headingAnchors` | `boolean` | `false` | Derive an `id` (WordPress `anchor` attribute) for each heading from its text, so in-page anchor links work. GitHub-style slugs, de-duplicated per document (`overview`, `overview-1`, …). A heading that slugs to nothing (only punctuation/emoji) gets no `id`. |
164
166
  | `resolveImage` | `(src, alt, title?) => ResolvedImage \| undefined` | — | Resolve a Markdown image to a WordPress image (see [Images](#images)). |
165
167
  | `codeLanguage` | `'drop' \| 'class'` | `'drop'` | `'drop'` discards the fence language (core behaviour). `'class'` emits `<code class="language-xxx">` for a syntax-highlighting plugin. |
166
168
  | `unsupported` | `'html' \| 'skip'` | `'html'` | How to handle raw/unsupported nodes: wrap in `core/html`, or omit. |