@geml/geml 1.4.6 → 1.5.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/dist/table.js CHANGED
@@ -247,9 +247,11 @@ function parseSpan(s) {
247
247
  export function parseTable(body, attrs, line, sink) {
248
248
  const diagnostics = [];
249
249
  const fmt = typeof attrs["format"] === "string" ? attrs["format"] : undefined;
250
- // External data source (§6): `src=` points at a CSV/TSV file or URL, loaded at
251
- // render time not read here. So compute/chart column-name checking for an
252
- // src table also happens at render time, and the inline body must be empty.
250
+ // Data from elsewhere (§6): the caller has normalised `src=`/`data=` into `src`.
251
+ // A local or cross-document target is resolved after the scan (resolveTableSources
252
+ // in geml.ts calls back into this function with the resolved lines, so format,
253
+ // header, compute and summary behave identically); only an `http(s)` URL is still
254
+ // a render-time fetch. Either way the inline body must be empty.
253
255
  const src = typeof attrs["src"] === "string" ? attrs["src"] : undefined;
254
256
  if (src !== undefined) {
255
257
  if (body.some((l) => l.trim() !== "")) {
package/dist/to-md.js CHANGED
@@ -38,6 +38,10 @@ function inline(n) {
38
38
  case "link": return `[${seq(n.children)}](${linkDest(n)})`;
39
39
  // Markdown has no auto-reference; project to a plain link to the anchor.
40
40
  case "autoref": return n.doc !== undefined ? `[${n.doc}#${n.anchor}](${n.doc}#${n.anchor})` : `[#${n.anchor}](#${n.anchor})`;
41
+ // An inline projection needs the target's body, which this projection has no
42
+ // resolver for. The link keeps the reference reachable; the loss is reported
43
+ // once for the document by gemlToMd.
44
+ case "project": return n.doc !== undefined ? `[${n.doc}#${n.anchor}](${n.doc}#${n.anchor})` : `[#${n.anchor}](#${n.anchor})`;
41
45
  case "footnote": return `[^${n.ref}]`;
42
46
  }
43
47
  }
@@ -139,8 +143,6 @@ function typedToMd(b, notes) {
139
143
  return fence(attr(b, "lang") ?? "", raw);
140
144
  if (b.type === "math")
141
145
  return ["$$", ...raw, "$$"].join("\n");
142
- if (b.type === "output")
143
- return fence("", raw);
144
146
  if (b.type === "table" && b.table)
145
147
  return tableToMd(b.table, notes);
146
148
  if (b.type === "diagram") {
@@ -153,6 +155,15 @@ function typedToMd(b, notes) {
153
155
  }
154
156
  return fence(fmt, raw); // mermaid renders on GitHub; others stay as a code block
155
157
  }
158
+ if (b.type === "embed") {
159
+ // Markdown has no transclusion, and the content lives in another file, so
160
+ // there is nothing to inline. A link to the target at least keeps the
161
+ // reference reachable; the unknown-type fallback below would emit an empty
162
+ // fence, which tells a reader nothing.
163
+ const target = typeof b.attrs["src"] === "string" ? b.attrs["src"].trim() : "";
164
+ notes.add("block transclusion projected as a link; the referenced content is not inlined (Markdown has no transclusion)");
165
+ return target === "" ? "" : `[${target}](${target})`;
166
+ }
156
167
  // Unknown raw type: preserve the body in a fenced block tagged with the type.
157
168
  notes.add(`unknown block type \`${b.type}\` emitted as a fenced code block`);
158
169
  return fence(b.type, raw);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geml/geml",
3
- "version": "1.4.6",
3
+ "version": "1.5.0",
4
4
  "mcpName": "io.github.geml-spec/geml",
5
5
  "publishConfig": {
6
6
  "access": "public"