MCPcopy
hub / github.com/markdoc/markdoc / node

Function node

src/transformer.ts:71–88  ·  view source on GitHub ↗
(node: Node, config: Config = {})

Source from the content-addressed store, hash-verified

69 },
70
71 node(node: Node, config: Config = {}) {
72 const schema = this.findSchema(node, config) ?? {};
73 if (schema && schema.transform instanceof Function)
74 return schema.transform(node, config);
75
76 const children = this.children(node, config);
77 if (!schema || !schema.render) return children;
78
79 const attributes = this.attributes(node, config);
80
81 if (isPromise(attributes) || isPromise(children)) {
82 return Promise.all([attributes, children]).then(
83 (values) => new Tag(schema.render, ...values)
84 );
85 }
86
87 return new Tag(schema.render, attributes, children);
88 },
89} as Transformer;

Callers

nothing calls this directly

Calls 5

isPromiseFunction · 0.90
childrenMethod · 0.80
attributesMethod · 0.80
findSchemaMethod · 0.65
transformMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…