@headwall/markdown-to-blocks 1.1.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,20 @@ 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
+
10
24
  ## [1.1.0] - 2026-06-28
11
25
 
12
26
  ### Changed
@@ -52,6 +66,7 @@ parser and confirmed to import into the block editor with no recovery prompts.
52
66
  - ESM-only. Requires Node ≥ 18.
53
67
  - Zero runtime dependencies — all bundled into the published package.
54
68
 
55
- [Unreleased]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.1.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
56
71
  [1.1.0]: https://github.com/headwalluk/markdown-to-blocks/compare/v1.0.0...v1.1.0
57
72
  [1.0.0]: https://github.com/headwalluk/markdown-to-blocks/releases/tag/v1.0.0
package/README.md CHANGED
@@ -3,8 +3,7 @@
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
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
- [![npm version](https://img.shields.io/npm/v/@headwall/markdown-to-blocks.svg)](https://www.npmjs.com/package/@headwall/markdown-to-blocks)
7
- [![npm downloads](https://img.shields.io/npm/dm/@headwall/markdown-to-blocks.svg)](https://www.npmjs.com/package/@headwall/markdown-to-blocks)
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)
8
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
9
8
  [![Node.js](https://img.shields.io/node/v/@headwall/markdown-to-blocks.svg)](https://nodejs.org)
10
9
  [![Types](https://img.shields.io/npm/types/@headwall/markdown-to-blocks.svg)](https://www.typescriptlang.org/)
@@ -19751,8 +19751,37 @@ function parseMarkdown(markdown, options) {
19751
19751
  const processor = options.gfm ? base.use(remarkGfm) : base;
19752
19752
  const tree = processor.parse(markdown);
19753
19753
  const root2 = processor.runSync(tree);
19754
+ resolveReferences(root2);
19754
19755
  return root2;
19755
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
+ }
19756
19785
  function createContext(options) {
19757
19786
  const context = {
19758
19787
  options,
@@ -19876,4 +19905,4 @@ export {
19876
19905
  markdownToBlocks,
19877
19906
  parseMarkdownDocument
19878
19907
  };
19879
- //# sourceMappingURL=chunk-73P6MFHU.js.map
19908
+ //# sourceMappingURL=chunk-7B766ZGD.js.map