@headwall/markdown-to-blocks 1.0.0 → 1.1.1

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,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.1] - 2026-06-29
11
+
12
+ ### Fixed
13
+
14
+ - Reference-style links (`[text][ref]`) and images (`![alt][ref]`) are now
15
+ resolved against their `[ref]: url` definitions instead of being silently
16
+ dropped (links lost their URL; images vanished entirely).
17
+
18
+ ### Changed
19
+
20
+ - CLI: exit with a clear "no input" message and usage hint instead of hanging
21
+ when run on an interactive terminal with no file argument and nothing piped to
22
+ stdin.
23
+
24
+ ## [1.1.0] - 2026-06-28
25
+
26
+ ### Changed
27
+
28
+ - **Require Node ≥ 20** (was ≥ 18). Node 18 is end-of-life; CI no longer tests
29
+ against it.
30
+
31
+ ### Added
32
+
33
+ - GitHub Actions CI: `typecheck` + `build` + `test` across Node 20, 22, and 24
34
+ on every push and pull request to `main`.
35
+
10
36
  ## [1.0.0] - 2026-06-28
11
37
 
12
38
  First stable release. Output is validated against WordPress core's own block
@@ -40,5 +66,7 @@ parser and confirmed to import into the block editor with no recovery prompts.
40
66
  - ESM-only. Requires Node ≥ 18.
41
67
  - Zero runtime dependencies — all bundled into the published package.
42
68
 
43
- [Unreleased]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.0.0...HEAD
69
+ [Unreleased]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.1...HEAD
70
+ [1.1.1]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.0...v1.1.1
71
+ [1.1.0]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.0.0...v1.1.0
44
72
  [1.0.0]: https://github.com/headwalluk/markdown-to-blocks/releases/tag/v1.0.0
package/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  > Convert Markdown into serialised WordPress/Gutenberg **block markup** — HTML with `<!-- wp:… -->` delimiters that drops straight into the block editor with no "Convert to blocks" or "this block contains unexpected content" prompts.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@headwall/markdown-to-blocks.svg)](https://www.npmjs.com/package/@headwall/markdown-to-blocks)
6
- [![npm downloads](https://img.shields.io/npm/dm/@headwall/markdown-to-blocks.svg)](https://www.npmjs.com/package/@headwall/markdown-to-blocks)
5
+ [![CI](https://github.com/headwalluk/markdown-to-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/headwalluk/markdown-to-blocks/actions/workflows/ci.yml)
6
+ [![version](https://img.shields.io/github/package-json/v/headwalluk/markdown-to-blocks?label=version)](https://www.npmjs.com/package/@headwall/markdown-to-blocks)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
8
8
  [![Node.js](https://img.shields.io/node/v/@headwall/markdown-to-blocks.svg)](https://nodejs.org)
9
9
  [![Types](https://img.shields.io/npm/types/@headwall/markdown-to-blocks.svg)](https://www.typescriptlang.org/)
@@ -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 ≥ 18**.
28
+ This puts the `md2blocks` command on your `PATH`. Requires **Node ≥ 20**.
29
29
 
30
30
  ### As a library
31
31
 
@@ -7831,7 +7831,7 @@ function pick(schema, prop) {
7831
7831
  return typeof schema === "string" ? schema : schema[prop];
7832
7832
  }
7833
7833
 
7834
- // node_modules/escape-string-regexp/index.js
7834
+ // node_modules/mdast-util-frontmatter/node_modules/escape-string-regexp/index.js
7835
7835
  function escapeStringRegexp(string3) {
7836
7836
  if (typeof string3 !== "string") {
7837
7837
  throw new TypeError("Expected a string");
@@ -7938,6 +7938,14 @@ function ccount(value2, character) {
7938
7938
  return count;
7939
7939
  }
7940
7940
 
7941
+ // node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js
7942
+ function escapeStringRegexp2(string3) {
7943
+ if (typeof string3 !== "string") {
7944
+ throw new TypeError("Expected a string");
7945
+ }
7946
+ return string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
7947
+ }
7948
+
7941
7949
  // node_modules/unist-util-is/lib/index.js
7942
7950
  var convert = (
7943
7951
  // Note: overloads in JSDoc can’t yet use different `@template`s.
@@ -8216,7 +8224,7 @@ function toPairs(tupleOrList) {
8216
8224
  return result;
8217
8225
  }
8218
8226
  function toExpression(find) {
8219
- return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
8227
+ return typeof find === "string" ? new RegExp(escapeStringRegexp2(find), "g") : find;
8220
8228
  }
8221
8229
  function toFunction(replace2) {
8222
8230
  return typeof replace2 === "function" ? replace2 : function() {
@@ -19743,8 +19751,37 @@ function parseMarkdown(markdown, options) {
19743
19751
  const processor = options.gfm ? base.use(remarkGfm) : base;
19744
19752
  const tree = processor.parse(markdown);
19745
19753
  const root2 = processor.runSync(tree);
19754
+ resolveReferences(root2);
19746
19755
  return root2;
19747
19756
  }
19757
+ function resolveReferences(tree) {
19758
+ const definitions = /* @__PURE__ */ new Map();
19759
+ visit(tree, "definition", (node2) => {
19760
+ definitions.set(node2.identifier, node2);
19761
+ });
19762
+ visit(tree, "linkReference", (node2) => {
19763
+ const def = definitions.get(node2.identifier);
19764
+ if (def == null) {
19765
+ return;
19766
+ }
19767
+ const link2 = node2;
19768
+ link2.type = "link";
19769
+ link2.url = def.url;
19770
+ link2.title = def.title ?? null;
19771
+ });
19772
+ visit(tree, "imageReference", (node2) => {
19773
+ const def = definitions.get(node2.identifier);
19774
+ if (def == null) {
19775
+ return;
19776
+ }
19777
+ const alt = node2.alt ?? "";
19778
+ const image2 = node2;
19779
+ image2.type = "image";
19780
+ image2.url = def.url;
19781
+ image2.title = def.title ?? null;
19782
+ image2.alt = alt;
19783
+ });
19784
+ }
19748
19785
  function createContext(options) {
19749
19786
  const context = {
19750
19787
  options,
@@ -19868,4 +19905,4 @@ export {
19868
19905
  markdownToBlocks,
19869
19906
  parseMarkdownDocument
19870
19907
  };
19871
- //# sourceMappingURL=chunk-27IDEF4L.js.map
19908
+ //# sourceMappingURL=chunk-7B766ZGD.js.map