@markdoc/markdoc 0.3.2 → 0.3.4

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/index.mjs CHANGED
@@ -6927,7 +6927,11 @@ var Node = class {
6927
6927
  resolve(config = {}) {
6928
6928
  return Object.assign(new Node(), this, {
6929
6929
  children: this.children.map((child) => child.resolve(config)),
6930
- attributes: resolve(this.attributes, config)
6930
+ attributes: resolve(this.attributes, config),
6931
+ slots: Object.fromEntries(Object.entries(this.slots).map(([name, slot2]) => [
6932
+ name,
6933
+ slot2.resolve(config)
6934
+ ]))
6931
6935
  });
6932
6936
  }
6933
6937
  findSchema(config = {}) {
@@ -7562,7 +7566,7 @@ function handleAttrs(token, type) {
7562
7566
  return {};
7563
7567
  }
7564
7568
  }
7565
- function handleToken(token, nodes, file, handleSlots, inlineParent) {
7569
+ function handleToken(token, nodes, file, handleSlots, addLocation, inlineParent) {
7566
7570
  if (token.type === "frontmatter") {
7567
7571
  nodes[0].attributes.frontmatter = token.content;
7568
7572
  return;
@@ -7604,18 +7608,20 @@ function handleToken(token, nodes, file, handleSlots, inlineParent) {
7604
7608
  const node2 = new Node(typeName, attrs, void 0, tag || void 0);
7605
7609
  const { position = {} } = token;
7606
7610
  node2.errors = errors;
7607
- node2.lines = token.map || parent.lines || [];
7608
- node2.location = {
7609
- file,
7610
- start: {
7611
- line: node2.lines[0],
7612
- character: position.start
7613
- },
7614
- end: {
7615
- line: node2.lines[1],
7616
- character: position.end
7617
- }
7618
- };
7611
+ if (addLocation !== false) {
7612
+ node2.lines = token.map || parent.lines || [];
7613
+ node2.location = {
7614
+ file,
7615
+ start: {
7616
+ line: node2.lines[0],
7617
+ character: position.start
7618
+ },
7619
+ end: {
7620
+ line: node2.lines[1],
7621
+ character: position.end
7622
+ }
7623
+ };
7624
+ }
7619
7625
  if (inlineParent)
7620
7626
  node2.inline = true;
7621
7627
  if (attributes && ["tag", "fence", "image"].includes(typeName))
@@ -7634,7 +7640,7 @@ function handleToken(token, nodes, file, handleSlots, inlineParent) {
7634
7640
  const isLeafNode = typeName === "image";
7635
7641
  if (!isLeafNode) {
7636
7642
  for (const child of token.children)
7637
- handleToken(child, nodes, file, handleSlots, inlineParent);
7643
+ handleToken(child, nodes, file, handleSlots, addLocation, inlineParent);
7638
7644
  }
7639
7645
  nodes.pop();
7640
7646
  }
@@ -7644,7 +7650,7 @@ function parser(tokens, args) {
7644
7650
  if (typeof args === "string")
7645
7651
  args = { file: args };
7646
7652
  for (const token of tokens)
7647
- handleToken(token, nodes, args?.file, args?.slots);
7653
+ handleToken(token, nodes, args?.file, args?.slots, args?.location);
7648
7654
  if (nodes.length > 1)
7649
7655
  for (const node2 of nodes.slice(1))
7650
7656
  node2.errors.push({